我试图理解" Referenced"在一个进程的smaps文件中。 根据内核文档:
"引用的"表示当前标记为引用的内存量或 。访问"
我理解"访问"的含义,但它的含义是什么"引用"? 如果它是所有被访问的内存,那么我希望它是" RSS" +"交换",但在下面的示例中,它不是那样的。
示例:
7f13e7577000-7f13e75c1000 rw-p 00000000 00:00 0 [heap]
Size: 296 kB
Rss: 156 kB
Pss: 156 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 4 kB
Private_Dirty: 152 kB
Referenced: 128 kB
Anonymous: 156 kB
AnonHugePages: 0 kB
Swap: 56 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Locked: 0 kB
答案 0 :(得分:1)
从定义内存页面的referenced
标志位的Linux kernel source code
PG_referenced
,PG_reclaim
用于回收匿名,文件支持的pagecache的页面。
在page_check_references()
中使用referenced
标志位,其中进一步记录为,
/*
* All mapped pages start out with page table
* references from the instantiating fault, so we need
* to look twice if a mapped file page is used more
* than once.
*
* Mark it and spare it for another trip around the
* inactive list. Another page table reference will
* lead to its activation.
*
* Note: the mark is set for activated pages as well
* so that recently deactivated but used pages are
* quickly recovered.
*/
此外,mark_page_accessed()
是从Linux内核中的各个位置调用的函数,它通过其生命周期的初始部分对页面的referenced
标志位进行更新:
(即从新分配页面开始)
* Mark a page as having seen activity.
*
* inactive,unreferenced -> inactive,referenced
* inactive,referenced -> active,unreferenced
* active,unreferenced -> active,referenced
*
* When a newly allocated page is not yet visible, so safe for non-atomic ops,
* __SetPageReferenced(page) may be substituted for mark_page_accessed(page).
*/
即。
referenced
=不会很快回收的活动页面缓存。