Thread (4 messages) 4 messages, 2 authors, 2016-03-30

Re: [RFC] mm: why cat /proc/pid/smaps | grep Rss is different from cat /proc/pid/statm?

From: Shakeel Butt <hidden>
Date: 2016-03-22 14:47:30

On Tue, Mar 22, 2016 at 6:55 AM, Xishi Qiu [off-list ref] wrote:
[root@localhost c_test]# cat /proc/3948/smaps | grep Rss
The /proc/[pid]/smaps read triggers the traversal of all of process's vmas
and then page tables and accumulate RSS on each present page table entry.

[root@localhost c_test]# cat /proc/3948/statm
1042 173 154 1 0 48 0
The files /proc/[pid]/statm and /proc/[pid]/status uses the counters
(MM_ANONPAGES & MM_FILEPAGES) in mm_struct to report RSS of a process.
These counters are modified on page table modifications. However the kernel
implements an optimization where each thread keeps a local copy of these
counters in its task_struct. These local counter are accumulated in the
shared counter of mm_struct after some number of page faults (I think 32)
faced by the thread and thus there will be mismatch with smaps file.

Shakeel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help