Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have some question about physical storage of the kernel data in Linux, I know that the upper 1 GB of the VIRTUAL memory of each process points to the same PHYSICAL location, but

  1. this piece of the data has to be contiguous in PHYSICAL media as in VIRTUAL MEMORY?
  2. does kernel data will take ONLY 1 GB of the PHYSICAL memory?
  3. can some pages of the kernel data be swapped to the disk (for example page tables, page global directory is always in physical memory and can't be swapped to disk as I understand)

edit

what is the point to divide 32 bit VIRTUAL address into two levels (level of page global directory - 10 bit, and second of page table - 10 bit) and offset 12 bit, if it is not pagable what are the advantages of those two levels?

share|improve this question

closed as off topic by Lekensteyn, John S Gruber, con-f-use, ajmitch, jokerdino Aug 22 '12 at 8:08

Questions on Ask Ubuntu are expected to relate to Ubuntu within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Seems like a better question for Unix and Linux site as it's not about anything unique to Ubuntu. There may be even more information available there to add to psusi's answer. –  John S Gruber Aug 20 '12 at 2:46

1 Answer 1

up vote 2 down vote accepted
  1. No, it does not have to be contiguous. Any virtual page can be mapped to any physical page.
  2. For the most part, yes, the kernel memory is limited to 1 GB, but the page cache can grow larger than that because only a small bit of it must be mapped into the kernel address space at a time.
  3. Kernel memory is non pagable.

Note that this applies to the 32 bit kernel only.

share|improve this answer
    
thank You for the answer, about 3, what is the point to divide 32 bit VIRTUAL address into two levels (level of page global directory - 10 bit, and second of page table - 10 bit) and offset 12 bit, if it is not pagable what are the advantages of those two levels? –  maicon Sep 9 '11 at 22:07
    
@maicon, the processor does that to allow the kernel to map virtual memory to physical memory in any way it likes. Whether it can swap those pages out to disk or not, and which ones it is willing to do so with is entirely up to the kernel. Linux chose not to allow any kernel memory to be paged out rather than try to keep track of what kernel pages are safe to swap or not ( can't swap out pages needed to do the disk IO to swap them back in ). It is split into multiple levels to allow the kernel to be able to swap out the page tables themselves, or to simply omit chunks of the page table. –  psusi Sep 10 '11 at 21:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.