vmalloc size

卜弋天 buyit at live.cn
Tue Jun 26 23:54:26 EDT 2012


> Now this also means that increasing vmalloc inadvertently reduces lowmem.
> Why is this designed such a way?

It may or may not depending on the amount of physical memory and the
size of the vmalloc space.

vmalloc space will normally increase vmalloc_end, which won't reduce lowmem.
If the end can't advance any further, then I believe that the start
can be reduced. This will reduce lowmem, if the lowmem overlaps with
vmalloc memory.

Okay! got that! 
VMALLOC_END is a define, it is decided staticly when compile.
but VMALLOC_START is a dynamic value, which is calculated when running.
VMALLOC_START depends on the "vmalloc=XXX" parameter which is passed by
bootloader(u-boot). so if you specify a large vmalloc size in bootloader, for example
"vmalloc=512M", the VMALLOC_START will be reduced accordingly.
the rough formula is as below:
1. define VMALLOC_END = 0xF0000000
2. pass in parameter "vmalloc=256M" in u-boot.
3. in kernel SW, a global variable VMALLOC_MIN = VMALLOC_END - vmalloc_size = 
      0xF0000000 - 256M = 0xE0000000
4. calculate total size of "mem=" which is passed by u-boot, for example total memory size is 1GB.
5. global variable high_memory = VMALLOC_MIN = 0xE0000000, so lowmem is from 0xC0000000 ~
0xE0000000, totoal 512MB, and total high memory is 512MB.
6. VMALLOC_START = high_memory + 8MB = 0xE0800000.
at last , the vmalloc region will be 0xE0800000 ~ 0xF0000000
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120627/fb537b7f/attachment.html 

More information about the Kernelnewbies mailing list