页描述符解读

每个物理页关联一个page描述符,这样通过软件形式维护物理内存: struct page {

第1个  unsigned long flags;

第2个  union {   struct address_space *mapping;   void *s_mem;   atomic_t compound_mapcount;  };

第3个  union {   pgoff_t index;   void *freelist;  };

 

union {第4个 #if defined(CONFIG_HAVE_CMPXCHG_DOUBLE) && defined(CONFIG_HAVE_ALIGNED_STRUCT_PAGE)   unsigned long counters; #else   unsigned counters; #endif   struct {    union {     atomic_t _mapcount;     unsigned int active;     struct {      unsigned inuse:16;      unsigned objects:15;      unsigned frozen:1;     };     int units;    };    atomic_t _refcount;   };  };

 

 

 union {第5个   struct list_head lru;   struct dev_pagemap *pgmap;   struct {    struct page *next; #ifdef CONFIG_64BIT    int pages;    int pobjects; #else    short int pages;    short int pobjects; #endif   };

 

  struct rcu_head rcu_head;第6个

  struct {第7个    unsigned long compound_head; #ifdef CONFIG_64BIT    unsigned int compound_dtor;    unsigned int compound_order; #else    unsigned short int compound_dtor;    unsigned short int compound_order; #endif   };

 

  第8个 #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && USE_SPLIT_PMD_PTLOCKS   struct {    unsigned long __pad;    pgtable_t pmd_huge_pte;   }; #endif  };

 

 union {第9个   unsigned long private; #if USE_SPLIT_PTE_PTLOCKS #if ALLOC_SPLIT_PTLOCKS   spinlock_t *ptl; #else   spinlock_t ptl; #endif #endif   struct kmem_cache *slab_cache;  };

 

第10个 #ifdef CONFIG_MEMCG  struct mem_cgroup *mem_cgroup; #endif

 

第11个 #if defined(WANT_PAGE_VIRTUAL)  void *virtual; #endif

 

第12个 #ifdef CONFIG_KMEMCHECK  void *shadow; #endif

 

第13个

#ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS  int _last_cpupid; #endif } 第一个成员flags给出了页相关标识,比如页状态啊。

第二个是一个联合体,其给出在一个页用于不同的目的时,不同成员标记不同目的。mapping用于当页被映射

地址空间时起作用;而s_mem是指,这个页被用于slab缓存了。而compound_mapcount是用于当多个页作为

一个整体看待时,compound_mapcount给出这些页被映射到页表结构的进程数目。

 

 
 
 
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值