欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Linux2.6内存布局

程序员文章站 2022-05-29 09:11:56
...

内存布局 2.6.11 Linux 32bit

  1. 假设有4个节点。
  2. 假设有大于896MB的内存。
  3. 除node0外,其他的每个node所占的空间为:
    size = (node_end_pfn[nid] - node_start_pfn[nid] + 1) * sizeof(struct page) + sizeof(pg_data_t)
  4. node0所占的空间为它所管理的页描述符的空间
    (node_end_pfn[0] - node_start_pfn[0] + 1) * sizeof(struct page) 由bootmem系统动态分配。

+----   0xffffffff   ---+-----------+-----------------------------------------------+--------------+
|                       |           | unused hole                                   |++++++++++++++|
|       0xfffff000   ---|-----------+------------| FIXADDR_TOP |--------------------|++++++++++++++|
|                       |           | vsyscalls                                     |++++++++++++++|
|       0xffffe000   ---+-----------+------------| VSYSCALL_ADDR |------------------|++++++++++++++|
|                       |           |                                               |++++++++++++++|
|       0xfffdc000   ---+-----------+------------| KMAP_BEGIN    |------------------|++++++++++++++|
|                       |           | kmap_atomic()/kunmap_atomic()                 |++++++++++++++|
|       0xfff75000   ---+-----------+------------| KMAP_END      |------------------|++++++++++++++|
|                       |           |                                               |++++++++++++++|
|       0xfff6e000   ---+-----------+------------| FIXADDR_START |------------------|++++++++++++++|
128MB                   |           |                                               |++++++++++++++|
|       0xfff5d000   ---+-----------+------------| FIXADDR_BOOT_START |-------------|++++++++++++++|
|                       |           |   kmap_high()/kunmap_high()                   |++++++++++++++|
|       0xff800000 +----+-----------+------------| PKMAP_BASE |---------------------|++++++++++++++|
|                  |    |    8KB    | hole                                          | kernel space |
|                  |    +-----------+------------| VMALLOC_END   |------------------|++++++++++++++|
|                  |    |           | vmalloc/ioremap space                         |++++++++++++++|
|                  |    +-----------+-----------------------------------------------|++++++++++++++|
|               120MB   |    4KB    | 4kb hole on interval of per vmalloc()         |++++++++++++++|
|                  |    +-----------+-----------------------------------------------|++++++++++++++|
|                  |    |           | vmalloc/ioremap space                         |++++++++++++++|
|                  |    +-----------+------------| VMALLOC_START |------------------|++++++++++++++|
|                  |    |    8MB    | hole                                          |++++++++++++++|
+----   0xf8000000 +----+-----------+-----------------------------------------------|++++++++++++++|
|                       |   NODE1   | (node_pages) * sizeof(struct page)            |++++++++++++++|
|                       +-----------+   + sizeof(pg_data_t)                         |++++++++++++++|
|                       |   NODE2   |                                               |++++++++++++++|
|                       +-----------+  var:vmalloc_earlyreserve (pages)             |++++++++++++++|
|                       |   NODE3   |                                               |++++++++++++++|
|   var:max_low_pfn  ---+-----------+------------|highstart_pfn|--------------------|++++++++++++++|
|                       |           |                                               |++++++++++++++|
896MB                   |           |                                               |++++++++++++++|
|                       |           | direct mapping of all phys. memory            |++++++++++++++|
|                       |           |                                               |++++++++++++++|
|                       |           |                                               |++++++++++++++|
|   var:mix_low_pfn  ---+-----------+-----------------------------------------------|++++++++++++++|
|                       |   NODE0   |     sizeof(pg_data_t)                         |++++++++++++++|
|init_pg_tables_end  ---+-----------+-----------------------------------------------|++++++++++++++|
|                       |           |     kernel text mapping, from phys 0          |++++++++++++++|
+----   0xC0000000   ---+-----------+--------------| __PAGE_OFFSET | ---------------+--------------+
|                       |           |                                               |xxxxxxxxxxxxxx|
|                       |           |                                               |xxxxxxxxxxxxxx|
|                       |           |                                               |xxxxxxxxxxxxxx|
|                       +-----------+-----------------------------------------------|xxxxxxxxxxxxxx|
|                       |           |                                               |xxxxxxxxxxxxxx|
|                       |           |                                               |xxxxxxxxxxxxxx|
|                       |           |                                               |xxxxxxxxxxxxxx|
|                       +-----------+-----------------------------------------------|xxxxxxxxxxxxxx|
|                       |           |                                               |xxxxxxxxxxxxxx|
3GB                     +-----------+-----------------------------------------------|  user space  |
|                       |           |                                               |xxxxxxxxxxxxxx|
|                       |           |                                               |xxxxxxxxxxxxxx|
|                       |           |                                               |xxxxxxxxxxxxxx|
|                       |           |                                               |xxxxxxxxxxxxxx|
|                       |           | different per mm                              |xxxxxxxxxxxxxx|
|                       |           |                                               |xxxxxxxxxxxxxx|
|                       |           |                                               |xxxxxxxxxxxxxx|
|                       |           |                                               |xxxxxxxxxxxxxx|
+-----  0x00000000  ----+-----------+-----------------------------------------------+--------------+

相关标签: Kernel