[ 0.000000] BIOS-e820: 0000000000000000 - 000000000008f000 (usable)
[ 0.000000] BIOS-e820: 000000000008f000 - 0000000000090000 (reserved)
[ 0.000000] BIOS-e820: 0000000000090000 - 000000000009e000 (usable)
[ 0.000000] BIOS-e820: 000000000009e000 - 00000000000a0000 (reserved)
[ 0.000000] BIOS-e820: 0000000000100000 - 00000000bf5bf000 (usable)
[ 0.000000] BIOS-e820: 00000000bf5bf000 - 00000000bf77f000 (reserved)
[ 0.000000] BIOS-e820: 00000000bf77f000 - 00000000bf7cf000 (ACPI NVS)
[ 0.000000] BIOS-e820: 00000000bf7cf000 - 00000000bf7ff000 (ACPI data)
[ 0.000000] BIOS-e820: 00000000bf7ff000 - 00000000bf800000 (usable)
[ 0.000000] BIOS-e820: 00000000f80f8000 - 00000000f80f9000 (reserved)
[ 0.000000] BIOS-e820: 00000000fed1c000 - 00000000fed20000 (reserved)
[ 0.000000] BIOS-e820: 00000000fff60000 - 00000000fff70000 (reserved)
[ 0.000000] BIOS-e820: 0000000100000000 - 0000000240000000 (usable)
0x0000000240000000 = 9216MB=9GB Physical memory; In fact, the board has 8G physical memory. Why 9G here? because some holes of 1GB is used for MMIO. Memory type is defined as:
33#define E820_RAM 1 (usable) 34#define E820_RESERVED 2 (reserved) 35#define E820_ACPI 3 (acpi data) 36#define E820_NVS 4 (acpi nvs)
[ 0.000000] last_pfn = 0x240000 max_arch_pfn = 0x1000000To enable PAE, use CONFIG_X86_PAE=y when compiling Linux Kernel.
Each physical frame frame is 4KB, so the last physical frame is 0x240000 = 0x0000000240000000 / 1000 = 0x240000 (frames); the Maximum architecture frame is
0x1000000 , so it is about 0x1000000 * 0x1000 = 64GB. Why 64GB here? because we enabled PAE extension on 32-bit architecture, and it extends memory from 4GB to 64GB.
For PAE, please see: http://en.wikipedia.org/wiki/Physical_Address_Extension
[ 0.000000] NX (Execute Disable) protection: active
NX bit means marking some memory region is not executable.
http://en.wikipedia.org/wiki/NX_bit
[ 0.000000] kernel direct mapping tables up to 60000000 @ 7000-d000
0x60000000= 1536M=1.5G (low memory); page table is at 28K~52K, physical frame from 7 to 13.
[ 0.000000] RAMDISK: 0077b000 - 0290e000
ramdisk sarts from 0x0077b000 , and ends at 0x0290e000. size is around 33MB.
[ 0.000000] 7680MB HIGHMEM available.
[ 0.000000] 1536MB LOWMEM available.
[ 0.000000] mapped low ram: 0 - 60000000
[ 0.000000] low ram: 00000000 - 60000000
[ 0.000000] bootmap 0000a000 - 00016000
Low memory is 1.5G and directly mapped, which means the translation between virtual and physical is simple and fast. Low memory is used by kernel directly. While high memory is not directly mapped, to access them,dynamically on-demand mapping is needed.
See: http://en.wikipedia.org/wiki/HighMem
http://linux.sys-con.com/node/431838?page=0,1
[ 0.000000] bootmap 0000a000 - 00016000
Page 10-22 for boot memory bitmap. After it is
Bootmem handling means how memory is allocated at boottime prior to paging start.
For bootmem, see the link:
http://mmdoc.sourceforge.net/mmdoc/node9.html
http://kneuro.net/linux-mm/index.php?file=bootmem.html
http://lwn.net/Articles/382559/
[ 0.000000] (9 early reservations) ==> bootmem [0000000000 - 0060000000]
[ 0.000000] #0 [0000000000 - 0000001000] BIOS data page ==> [0000000000 - 0000001000]
[ 0.000000] #1 [0000001000 - 0000002000] EX TRAMPOLINE ==> [0000001000 - 0000002000]
[ 0.000000] #2 [0000006000 - 0000007000] TRAMPOLINE ==> [0000006000 - 0000007000]
[ 0.000000] #3 [0000100000 - 000069fd30] TEXT DATA BSS ==> [0000100000 - 000069fd30]
[ 0.000000] #4 [000077b000 - 000290e000] RAMDISK ==> [000077b000 - 000290e000]
[ 0.000000] #5 [00006a0000 - 00006a8000] INIT_PG_TABLE ==> [00006a0000 - 00006a8000]
[ 0.000000] #6 [000009f000 - 0000100000] BIOS reserved ==> [000009f000 - 0000100000]
[ 0.000000] #7 [0000007000 - 000000a000] PGTABLE ==> [0000007000 - 000000a000]
[ 0.000000] #8 [000000a000 - 0000016000] BOOTMAP ==> [000000a000 - 0000016000]
Early reservation for bootmem, and we can see clearly:
BIOS DATA PaGE is the 1st page; Linux kernel sits in
0000100000 - 000069fd30; Ramdisk is at
000077b000 - 000290e000; Init_pg_table is at
00006a0000 - 00006a8000; while early boot map
is at
000000a000 - 0000016000.
For kernel memory, see http://www.linuxjournal.com/article/6930
[ 0.000000] Zone PFN ranges:
[ 0.000000] DMA 0x00000000 -> 0x00001000
[ 0.000000] Normal 0x00001000 -> 0x00060000
[ 0.000000] HighMem 0x00060000 -> 0x00240000
The 1st 16M is for DMA(ISA can only do so; for PCI device or other architectur, all memory are DMAable); 16M-1.5G for Linux kernel; while above 1.5G is for user process.
[ 0.000000] Movable zone start PFN for each node
[ 0.000000] early_node_map[5] active PFN ranges
[ 0.000000] 0: 0x00000000 -> 0x0000008f
[ 0.000000] 0: 0x00000090 -> 0x0000009e
[ 0.000000] 0: 0x00000100 -> 0x000bf5bf
[ 0.000000] 0: 0x000bf7ff -> 0x000bf800
[ 0.000000] 0: 0x00100000 -> 0x00240000
[ 0.000000] On node 0 totalpages: 2094429
[ 0.000000] free_area_init_node: node 0, pgdat 80574e80, node_mem_map 8290e000
[ 0.000000] DMA zone: 3945 pages, LIFO batch:0
[ 0.000000] Normal zone: 384180 pages, LIFO batch:31
[ 0.000000] HighMem zone: 1676352 pages, LIFO batch:31
Where are the overhead??
[ 0.010000] Memory: 8214964k/9437184k available (3132k kernel code, 161948k reserved, 1529k data, 304k init, 6805248k highmem)
[ 0.010000] virtual kernel memory layout:
[ 0.010000] fixmap : 0xffb98000 - 0xfffff000 (4508 kB)
[ 0.010000] pkmap : 0xff600000 - 0xff800000 (2048 kB)
[ 0.010000] vmalloc : 0xe0800000 - 0xff5fe000 ( 493 MB)
[ 0.010000] lowmem : 0x80000000 - 0xe0000000 (1536 MB)
[ 0.010000] .init : 0x80594000 - 0x805e0000 ( 304 kB) //Kernel bss
[ 0.010000] .data : 0x8040f326 - 0x8058d820 (1529 kB) //Kernel data
[ 0.010000] .text : 0x80100000 - 0x8040f326 (3132 kB) // kernel code
0x80000000 - 0xe0000000 is the virtual address of low memory--- the 1st 1.5G.
From http://www.makelinux.net/ldd3/chp-8-sect-4
"The (virtual) address range used by kmalloc and _ _get_free_pages features a one-to-one mapping to physical memory, possibly shifted by a constant PAGE_OFFSET value; the functions don't need to modify the page tables for that address range. The address range used by vmalloc and ioremap, on the other hand, is completely synthetic, and each allocation builds the (virtual) memory area by suitably setting up the page table? "
so kmalloc allocates physically continuous memory; while vmalloc allocates a contiguous memory region in the virtual address space. ; ioremap just manipulate the page table instead of allocate memory.
for fixmap:
"
66 * These 'compile-time allocated' memory buffers are 67 * fixed-size 4k pages (or larger if used with an increment 68 * higher than 1). Use set_fixmap(idx,phys) to associate 69 * physical memory with fixmap indices.
"
33/*
34 * Right now we initialize only a single pte table. It can be extended
35 * easily, subsequent pte tables have to be allocated in one physical
36 * chunk of RAM.
37 */
38/*
39 * Ordering is:
40 *
41 * FIXADDR_TOP
42 * fixed_addresses
43 * FIXADDR_START
44 * temp fixed addresses
45 * FIXADDR_BOOT_START
46 * Persistent kmap area
47 * PKMAP_BASE
48 * VMALLOC_END
49 * Vmalloc area
50 * VMALLOC_START
51 * high_memory
52 */
PowerPC Memory Map:
On node 0 totalpages: 65536
DMA zone: 65536 pages, LIFO batch:16
Normal zone: 0 pages, LIFO batch:1
HighMem zone: 0 pages, LIFO batch:1
Built 1 zonelists
256M = 64K pages = 64K * 4KB
No comments:
Post a Comment