眼花的页结构体
庞然大物
struct page (include/linux/mm_types.h)
page
+--------------------------------------------------------------+
|flags | page-flags-layout.h
| (unsigned long) | page-flags.h
--+-- +==============================================================+
| |..............................................................|
| |page cache and anonymous pages |
| | +---------------------------------------------------------+
| | |lru |
| | | (struct list_head) |
| |mapping |
| | (struct address_space*) |
| |index |
| | (pgoff_t) |
5 words | |private |
union | | (unsigned long) |
| +---------------------------------------------------------+
|..............................................................|
has |slab, slob, slub |
| +---------------------------------------------------------+
7 usage | |.........................................................|
| | .+---------------------------|
| |slab_list .|next |
| | (struct list_head) .| (struct page*) |
| | .|pages |
| | .|pobjects |
| | .| (int) |
| | .+---------------------------|
| |.........................................................|
| +---------------------------------------------------------+
| |slab_cache |
| | (struct kmem_cache*) |
| |freelist |
| | (void*) |
| +---------------------------------------------------------+
| |.........................................................|
| |s_mem .counters .+---------------------------|
| | (void*) . (unsigned long) .|inuse |
| | . .|objects |
| | . .|frozen |
| | . .| (unsigned) |
| | . .+---------------------------|
| |.........................................................|
| +---------------------------------------------------------+
|..............................................................|
|Tail pages of compound page |
| +---------------------------------------------------------+
| |compound_head |
| | (unsigned long) |
| |compound_dtor |
| |compound_order |
| | (unsigned char) |
| |compound_mapcount |
| | (atomic_t) |
| +---------------------------------------------------------+
|..............................................................|
|Second tail page of compound page |
| +---------------------------------------------------------+
| |_compound_pad_1 |
| |_compound_pad_2 |
| | (unsigned long) |
| |deferred_list |
| | (struct list_head) |
| +---------------------------------------------------------+
|..............................................................|
|Page table pages |
| +---------------------------------------------------------+
| |_pt_pad_1 |
| | (unsigned long) |
| |pmd_huge_pte |
| | (pgtable_t) |
| |_pt_pad_2 |
| | (unsigned long) |
| |.........................................................|
| |pt_mm .pt_frag_refcount |
| | (struct mm_struct*) . (atomic_t) |
| |.........................................................|
| |ptl |
| | (spinlock_t/spinlock_t *) |
| +---------------------------------------------------------+
|..............................................................|
|ZONE_DEVICE pages |
| +---------------------------------------------------------+
| |pgmap |
| | (struct dev_pagemap*) |
| |hmm_data |
| |_zd_pad_1 |
| | | (unsigned long) |
| | +---------------------------------------------------------+
| |..............................................................|
| |rcu_head |
| | (struct rcu_head) |
| |..............................................................|
--+-- +==============================================================+
| |..............................................................|
| . . . |
4 bytes |_mapcount .page_type .active .units |
union | (atomic_t). (unsigned int). (unsigned int). (int) |
| . . . |
| |..............................................................|
--+-- +==============================================================+
|_refcount |
| (atomic_t) |
|mem_cgroup |
| (struct mem_cgroup) |
|virtual |
| (void *) |
|_last_cpupid |
| (int) |
+--------------------------------------------------------------+page->flags
布局
FLAGS定义
FLAGS操作
定义FLAGS操作
policy
PageType
Last updated