Virtual address space layout [mem_map/memmap]

VMEMMAP_SIZE

 The kernel uses a page structure to describe a physical page, and all physical pages of memory correspond to an array of page structures. If the physical address space of the memory is discontinuous and there are many holes, it is called sparse memory. The vmemmap area is the virtual address space of the page structure array of sparse memory.

 According to the comment: the size of this area can store all struct page object arrays, and this array can cover the entire linear mapping area. 
#define VMEMMAP_SIZE \

(UL(1) << (VA_BITS - PAGE_SHIFT - 1 + STRUCT_PAGE_MAX_SHIFT))

(Kernel virtual space size/4096/2=number of pages (P) in the kernel linearly mapped address space, corresponding to the total virtual memory occupied by the page structure=P*BITS( STRUCT_PAGE_MAX_SHIFT )=2^6*P . )


Example: sizeof struct page is 44 bytes. 2^5 = 32 < 44 ; 2^6 = 64 > 44; then STRUCT_PAGE_MAX_SHIFT is 6. shift is shift, max is maximum. In such a large space, the next struct page object can definitely be stored.

2 modules

If the CONFIG_MODULES function is defined, it is necessary to open up a space in the user space for the modules inserted by insmod.

This part of space is dynamically mapped, in the case of defining CONFIG_HIGHMEM, it is 16MB-2MB=14MB, from 0xbf00000 - 0xbfe00000.

128M in AARCH64

 

Guess you like

Origin blog.csdn.net/y13182588139/article/details/125817492