memblock 分配器 定义在 Linux 内核源码的 linux-4.12\include\linux\memblock.h#48 位置 ;
struct memblock {
bool bottom_up; /* is bottom up direction? */
phys_addr_t current_limit;
struct memblock_type memory;
struct memblock_type reserved;
#ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP
struct memblock_type physmem;
#endif
};
源码路径 : linux-4.12\include\linux\memblock.h#48
memblock
结构体中的 memory
( 内存类型 ) , reserved
( 预留类型 ) , physmem
( 物理页内存类型 ) 这
个成员都是 memblock_type
结构体实例 ;
struct memblock_type
结构体 定义在 Linux 内核源码的 linux-4.12\include\linux\memblock.h#40 位置 ;
struct memblock_type {
unsigned long cnt; /* number of regions */
unsigned long max; /* size of the allocated array */
phys_addr_t total_size; /* size of all regions */
struct memblock_region *regions;
char *name;
};
源码路径 : linux-4.12\include\linux\memblock.h#40
其中的 regions
成员是 struct memblock_region
结构体类型的指针 ;