Thank you guys! I have two more questions from your replies: - I thought I had understood HIGH_MEM and LOW_MEM, but it appears I was wrong. Does the concept of high memory/low memory correspond to physical address space or virtual address space? Also, does LOW_MEM always have to be 1 GiB maximum? - For a RAM of 896 MiB - 4096 MiB, the book says: "In this case, the RAM cannot be mapped entirely into the kernel linear address space. The best Linux can do during the initialization phase is to map a RAM window of size 896 MB into the kernel linear address space." Why is there a need to map the whole RAM into the kernel space (the usage of the word "entirely") ? Shouldn't it be only LOW_MEM ? Or am I confusing the two things here ? I believe all doubts are pointing to the concepts of LOW_MEM and HIGH_MEM, but I'm still not being able to wrap my head around them. Thanks, Sunny On Thu, Mar 12, 2015 at 11:49 PM, Jeff Haran <Jeff.Haran@citrix.com> wrote:
-----Original Message----- From: kernelnewbies-bounces@kernelnewbies.org [mailto: kernelnewbies-bounces@kernelnewbies.org] On Behalf Of Arun KS Sent: Thursday, March 12, 2015 11:03 AM To: Sunny Shah Cc: kernelnewbies Subject: Re: Understanding the mapping of physical memory to kernel address space
Hello Sunny,
On Thu, Mar 12, 2015 at 10:32 PM, Sunny Shah <shahsunny715@gmail.com> wrote:
Hello,
This is my first mail on this list, so please let me know if I'm erring.
I'm reading Bovet and Cesati's "Understanding the Linux Kernel", specifically the chapter "Memory Addressing", sub-section "Kernel Page Tables". Here they describe how Linux initializes its page tables for various RAM sizes and how much of the physical address space is mapped onto the kernel virtual address space.
I have several questions from my reading:
My understanding is that the 32 bit virtual address space of a process is split into 2 parts - the first 3 GiB for the user space and the remaining 1GiB for the kernel (with the same kernel mapping being used for all processes. However, although the kernel is mapped into the higher portion of the address space, it resides in the lower 1 GiB of RAM. Is this correct? Yes. Incase of 3:1 mapping, kernel virtual address starts at 0xc0000000. You can also have 2:2 mappings aswell. It is a configurable option
Just an FYI, I've seen 1:3 mapping too. We had to do that with the kernels we built when I was at one company because we needed 3GB of virtual address space to map all of the memory mapped registers on their ASICs.
There's lots of options here.
Jeff Haran