Find the answer to your Linux question:
Results 1 to 9 of 9
Hello Linux Community, I am working on a kernel (3.4.3) and trying to figure out if I can specify (to some degree) the physical memory addresses a process will be ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2012
    Posts
    11

    Specifying Physical Memory Addresses


    Hello Linux Community,

    I am working on a kernel (3.4.3) and trying to figure out if I can specify (to some degree) the physical memory addresses a process will be assigned.

    I can't find much information on the matter and have three main questions on the subject.

    1. Is it possible to specify the physical memory addresses (to any extent) without breaking a large part of the system? I would mostly be interested in forcing certain processes to require memory from within a certain range (say Process X can only use pages between 0x00E00000 and 0x00F00000).

    2. What is the kernel's standard algorithm for allocating physical memory? Does it just grab the next available page(s), or is there a higher degree of complexity involved?

    3. Where can I find the code for allocating new physical pages? I assumed it would be secreted somewhere within page table initializations, but I can't seem to pin it down.

    Any help or advice you can offer me would be much appreciate.

    Regards,

    Misiu

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,393
    The ONLY time you should futz with physical memory addresses is when you are doing DMA operations with hardware that has memory that is mapped to specific hard locations. So, what exactly are you trying to do?

    If it is to access memory on external hardware, then check out what they do with the vga video driver. The source is in the kernel tree.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    May 2012
    Posts
    11
    I am attempting to manipulate what sections of a higher level cache each process will have access to by exploiting how cache indexing works. In this case, I want to restrict a process' physical memory allocation to within a specific set of pages. In turn, this will make sure that process only has access to the cache lines indexed by that memory range.

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,393
    Quote Originally Posted by Misiu10 View Post
    I am attempting to manipulate what sections of a higher level cache each process will have access to by exploiting how cache indexing works. In this case, I want to restrict a process' physical memory allocation to within a specific set of pages. In turn, this will make sure that process only has access to the cache lines indexed by that memory range.
    Sounds like a senior-level or graduate software engineering project? If so, know that forums terms-of-use won't allow us to help you, but we can at least point you to web sites where you can find your answers, such as www.kernel.org, The Linux Documentation Project, etc.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,393
    You might also try sending an email to Linus Torvalds at The Linux Foundation.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  6. #6
    Just Joined!
    Join Date
    May 2012
    Posts
    11
    Quote Originally Posted by Rubberman View Post
    Sounds like a senior-level or graduate software engineering project? If so, know that forums terms-of-use won't allow us to help you, but we can at least point you to web sites where you can find your answers, such as kernel.org, The Linux Documentation Project, etc.
    While it is true that this pertains to my area of research as a graduate student, this has nothing to do with any class or project I have been assigned and can only be classified as "independent research". It pertains to a problem I have encountered in literature and I am experimenting to see if it might be solved through an unusual assignment of memory addresses. I am, however, relatively new to modifying Linux kernels and was hoping someone could point me in the right direction as to how to implement my idea, or at let me know if my I am soon to hit a brick wall. From my understanding this is not in violation of the Forum Rules. If this is not the case then I apologize and will look elsewhere for my answers.

    As for contacting some of the more prestigious developers (Linus and others), I would prefer to post my situation and have them come to me if they are interested. This is a fairly ill-informed inquiry and I wouldn't want to put others under the obligation of setting me straight.

    Anyway, thanks for your help so far Rubberman. I have so far been perusing through my kernel's source code. But I will see if I can find some better documentation through the sources you provided.

    Cheers,

    -Misiu

  7. #7
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,393
    No. Independent research doesn't, at least in my book, qualify as "homework"... That said, I'd still have to point you to the kernel.org and Linux Documentation Project for more details. I have written device drivers and kernel modules, but I haven't had to delve into the memory management cruft so deeply, so I am basically clueless! However, all that said, please do post something here when you get it sorted out - inquiring minds and all that!

    Thanks.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  8. #8
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,393
    By the way, here is a link that may get your question to the right people!

    linux kernel monkey log
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  9. #9
    Just Joined!
    Join Date
    May 2012
    Posts
    11
    Thanks to Rubberman, I think I have found enough information to answer my own questions.

    It seems that the kernel maintains a list of free pages in the form of a list called free_area, it also keeps track of how many consecutive pages are available for each page. I believe I can specify attributes of the physical pages an application is allocated by changing how the kernel retrieves pages from this struct (if I want an application to have only have pages less than a certain address I just search through the list for them).

    As for how the kernel assigns pages by default, it seems to just grab the first available from the list (so long as it finds a string of consecutive pages long enough).

    Well, I believe I have my answers, and I hope I have left enough behind to help anyone with the same questions.

    Thanks again for the links, I will certainly be using TLDP for some time to come.

    -Misiu

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •