Linux物理内存相关数据结构
节点:pg_data_t
typedef struct pglist_data { zone_t node_zones[MAX_NR_ZONES]; zonelist_t node_zonelists[NR_GFPINDEX]; struct page *node_mem_map; unsigned long *valid_addr_bitmap; struct bootmem_data *bdata; unsigned long node_start_paddr; unsigned long node_start_mapnr; unsigned long node_size; int node_id; struct pglist_data *node_next; } pg_data_t;
所有的节点都由链表pgdat_list维护,所有的节点都在链表中,由函数init_bootmem_core初始化节点。
管理区:struct zone_t
typedef struct zone_struct { /* * Commonly accessed fields: */ spinlock_t lock; unsigned long offset; unsigned long free_pages; unsigned long inactive_clean_pages; unsigned long inactive_dirty_pages; unsigned long pages_min, pages_low, pages_high; /* * free areas of different sizes */ struct list_head inactive_clean_list; free_area_t free_area[MAX_ORDER]; /* * rarely used fields: */ char *name; unsigned long size; /* * Discontig memory support fields. */ struct pglist_data *zone_pgdat; unsigned long zone_start_paddr; unsigned long zone_start_mapnr; struct page *zone_mem_map; } zone_t;
页面:page
typedef struct page { struct list_head list; struct address_space *mapping; unsigned long index; struct page *next_hash; atomic_t count; unsigned long flags; /* atomic flags, some possibly updated asynchronously */ struct list_head lru; unsigned long age; wait_queue_head_t wait; struct page **pprev_hash; struct buffer_head * buffers; void *virtual; /* non-NULL if kmapped */ struct zone_struct *zone; } mem_map_t;
-------------------------------
问道,修仙
-------------------------------