4

According to Documentation/x86/x86_64/mm.txt, the layout of kernel space should be like this in 64bit linux:

  6 0000000000000000 - 00007fffffffffff (=47 bits) user space, different per mm
  7 hole caused by [48:63] sign extension
  8 ffff800000000000 - ffff80ffffffffff (=40 bits) guard hole
  9 ffff880000000000 - ffffc7ffffffffff (=64 TB) direct mapping of all phys. memory
 10 ffffc80000000000 - ffffc8ffffffffff (=40 bits) hole
 11 ffffc90000000000 - ffffe8ffffffffff (=45 bits) vmalloc/ioremap space
 12 ffffe90000000000 - ffffe9ffffffffff (=40 bits) hole
 13 ffffea0000000000 - ffffeaffffffffff (=40 bits) virtual memory map (1TB)
 14 ... unused hole ...
 15 ffffffff80000000 - ffffffffa0000000 (=512 MB)  kernel text mapping, from phys 0
 16 ffffffffa0000000 - fffffffffff00000 (=1536 MB) module mapping space

But how does the kernel space layout in 32bit linux looks like? What description I can find is all about ZONE_DMA, ZONE_NORMAL, ZONE_HIGHMEM, but these doesn't tell me details like where is the physmap address, or where is kernel code and kernel modules etc. What exactly are they like?

Thanks for any help:)

1

Well, now I think I can give myself an answer:)

In a word, in 32-bit linux, some kernel regions collide to prevent waste of limited kernel virtual address space(e.g., modules and vmalloc arena, kernel image and physmap) so the layout of kernel space may not be as clear as it is in 64-bit.

The layout of kernel space in 32-bit linux on x86 should be like this (some differences from AArch32: http://www.arm.linux.org.uk/developer/memory.txt):

fixmap  : 0xffc57000 - 0xfffff000   (3744 kB)
pkmap   : 0xff800000 - 0xffa00000   (2048 kB)
vmalloc : 0xf7ffe000 - 0xff7fe000   ( 120 MB)
lowmem  : 0xc0000000 - 0xf77fe000   ( 887 MB)
  .init : 0xc0906000 - 0xc0973000   ( 436 kB)
  .data : 0xc071ae6a - 0xc08feb78   (1935 kB) 
  .text : 0xc0400000 - 0xc071ae6a   (3179 kB)

According to definition of ZONE in 32-bit linux, ZONE_HIGHMEM includes the region of fixmappkmap, vmalloc(kernel modules will use vmalloc region). The lowmem area consists of ZONE_DMA and ZONE_NORMAL. It is mapped linearly from physical memory and the so-called physmap refers exactly to this region. The .init, .data, .text inside of lowmem belong to the kernel image, which is a separate area in 64-bit linux.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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