免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5558 | 回复: 1
打印 上一主题 下一主题

[内存管理] NR_FILE_PAGES统计哪些内存 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2014-11-11 10:04 |只看该作者 |倒序浏览
各位大侠,问一下zone_stat_item中,NR_FILE_PAGES是对哪些内存的统计?

enum zone_stat_item {
        /* First 128 byte cacheline (assuming 64 bit words) */
        NR_FREE_PAGES,
        NR_LRU_BASE,
        NR_INACTIVE_ANON = NR_LRU_BASE, /* must match order of LRU_[IN]ACTIVE */
        NR_ACTIVE_ANON,                /*  "     "     "   "       "         */
        NR_INACTIVE_FILE,        /*  "     "     "   "       "         */
        NR_ACTIVE_FILE,                /*  "     "     "   "       "         */
        NR_UNEVICTABLE,                /*  "     "     "   "       "         */
        NR_MLOCK,                /* mlock()ed pages found and moved off LRU */
        NR_ANON_PAGES,        /* Mapped anonymous pages */
        NR_FILE_MAPPED,        /* pagecache pages mapped into pagetables.
                           only modified from process context */
        NR_FILE_PAGES,
        NR_FILE_DIRTY,
        NR_WRITEBACK,
        NR_SLAB_RECLAIMABLE,
        ......
}

论坛徽章:
9
辰龙
日期:2014-08-18 20:38:42未羊
日期:2014-09-04 08:50:45丑牛
日期:2014-09-06 00:12:55寅虎
日期:2014-12-22 20:50:56摩羯座
日期:2015-01-14 22:28:15巳蛇
日期:2015-01-23 20:39:272015年辞旧岁徽章
日期:2015-03-03 16:54:1515-16赛季CBA联赛之青岛
日期:2016-03-13 23:37:1915-16赛季CBA联赛之深圳
日期:2016-03-29 18:52:38
2 [报告]
发表于 2014-11-11 21:45 |只看该作者
回复 1# babatengwo

文件使用的page cache的数量。
  1. /**
  2. * add_to_page_cache - add newly allocated pagecache pages
  3. * @page:        page to add
  4. * @mapping:        the page's address_space
  5. * @offset:        page index
  6. * @gfp_mask:        page allocation mode
  7. *
  8. * This function is used to add newly allocated pagecache pages;
  9. * the page is new, so we can just run SetPageLocked() against it.
  10. * The other page state flags were set by rmqueue().
  11. *
  12. * This function does not add the page to the LRU.  The caller must do that.
  13. */
  14. int add_to_page_cache(struct page *page, struct address_space *mapping,
  15.                 pgoff_t offset, gfp_t gfp_mask)
  16. {
  17.         int error = radix_tree_preload(gfp_mask & ~__GFP_HIGHMEM);

  18.         if (error == 0) {
  19.                 write_lock_irq(&mapping->tree_lock);
  20.                 error = radix_tree_insert(&mapping->page_tree, offset, page);
  21.                 if (!error) {
  22.                         page_cache_get(page);
  23.                         SetPageLocked(page);
  24.                         page->mapping = mapping;
  25.                         page->index = offset;
  26.                         mapping->nrpages++;
  27.                         __inc_zone_page_state(page, NR_FILE_PAGES);
  28.                 }
  29.                 write_unlock_irq(&mapping->tree_lock);
  30.                 radix_tree_preload_end();
  31.         }
  32.         return error;
  33. }
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP