1 struct pglist_data pg_data_t
typedef struct pglist_data { struct zone node_zones[MAX_NR_ZONES]; struct zonelist node_zonelists[MAX_ZONELISTS]; int nr_zones; #ifdef CONFIG_FLAT_NODE_MEM_MAP /* means !SPARSEMEM */ struct page *node_mem_map; #ifdef CONFIG_CGROUP_MEM_RES_CTLR struct page_cgroup *node_page_cgroup; #endif #endif #ifndef CONFIG_NO_BOOTMEM struct bootmem_data *bdata; #endif #ifdef CONFIG_MEMORY_HOTPLUG /* * Must be held any time you expect node_start_pfn, node_present_pages * or node_spanned_pages stay constant. Holding this will also * guarantee that any pfn_valid() stays that way. * * Nests above zone->lock and zone->size_seqlock. */ spinlock_t node_size_lock; #endif unsigned long node_start_pfn; unsigned long node_present_pages; /* total number of physical pages */ unsigned long node_spanned_pages; /* total size of physical page range, including holes */ int node_id; wait_queue_head_t kswapd_wait; struct task_struct *kswapd; int kswapd_max_order; } pg_data_t;
2 struct zonenode_zones[MAX_NE_ZONES]
struct zone node_zones[MAX_NR_ZONES]; //每个内存节点最多包含3个内存页区 //DMA最低位,normal中间位置,HighMem最高位置 //MAX_NR_ZONES枚举在include/linux/mmzone.h的struct zone_type中
3 struct zonelist node_zonelists[MAX_ZONELISTS]
struct zonelist node_zonelists[MAX_ZONELISTS]; //上一行的struct node_zone[]数组中 0-DMA,1-normal,2-HighMem //这里的node_zonelists[]数组中 0-normal,1-DMA,2-HighMem //故其对应关系为node_zonelists[0/1/2]->zone[0] = &node_zones[1/0/2]
3 int nr_zones
int nr_zones; //内存页区数量
4 struct page *node_mem_map
struct page_cgroup *node_page_cgroup
#ifdef CONFIG_FLAT_NODE_MEM_MAP /* means !SPARSEMEM */ struct page *node_mem_map; #ifdef CONFIG_CGROUP_MEM_RES_CTLR struct page_cgroup *node_page_cgroup; #endif #endif //struct page *node_mem_map 表示该节点内存所有页描述结构变量空间的起始地址 //struct bootmem_data *bdata内存节点启动阶段内存管理数据结构指针,具体如下 typedef struct bootmem_data { unsigned long node_min_pfn; //内存node空间的物理基址 unsigned long node_low_pfn; //.....物理终址 void *node_bootmem_map; //.....虚拟起始地址,mem_init()可将其清除为NULL unsigned long last_end_off; //上次分配结束时的地址偏移量 unsigned long hint_idx; //上一次从本内存节点中的物理起始地址的的相对偏移量 struct list_head list; } bootmem_data_t;