Query regarding kernel memory
Dave Hylands
dhylands at gmail.com
Mon Jul 25 20:51:10 EDT 2011
Hi Vaibhav,
On Mon, Jul 25, 2011 at 3:17 PM, Vaibhav Jain <vjoss197 at gmail.com> wrote:
> Hi,
>
> I read a few articles on linux virtual memory management such as this one :
> http://lwn.net/Articles/75174/
>
> which say that earlier linux kernel could only use memory slightly below 1
> GB. They have
> given the reason for it but I am unable to understand.They further describe
> the use of High memory and low memory.
> Could anybody please explain the reason for kernel not being able to use the
> 1 GB completely?
> Also please provide references for high memory and low memory.
My numbers/comments are for the ARM processor, the x86 may be slightly
different.
The typical configuration for the kernel has addresses from 0x00000000
through 0xC0000000 given to user space (it's actually a small amount
less than 3 GB since modules are loaded in the space just before
0xC0000000).
That leaves 0xC0000000 to 0xFFFFFFFF for kernel virtual memory (or 1
Gb). Now devices need some I/O space, which takes away from the 1Gb.
I think what you're calling low memory is kernel logical memory. See
http://lwn.net/images/pdf/LDD3/ch15.pdf on page 414 (not the 414th
page of the PDF, but the page with 414 printed on the bottom).
High memory is memory which is not directly accessible by the kernel.
You need to use kmap/kunmap to map the memory into the kernel virtual
memory space. Low memory is always accessible by the kernel.
So user-mode programs get allocated from high-memory (if high memory
exists) since the kernel doesn't typically need to access the
user-space memory.
It is possible to set some CONFIG options and have the 3Gb/1Gb split
changed to 2Gb/2Gb or 1Gb/3Gb, but 3Gb/1Gb is the normal default.
--
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com
More information about the Kernelnewbies
mailing list