Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1367047

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

From Xishi Qiu <qiuxishi@huawei.com>
Newsgroups linux.kernel
Subject Re: [RFC] mm: why cat /proc/pid/smaps | grep Rss is different from cat /proc/pid/statm?
Date 2016-03-30 11:50 +0200
Message-ID <rikVb-3my-7@gated-at.bofh.it> (permalink)
References <rfv0K-5cK-11@gated-at.bofh.it> <riiA3-1Vf-37@gated-at.bofh.it> <riiA3-1Vf-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2016/3/30 15:16, Xishi Qiu wrote:

> On 2016/3/22 22:47, Shakeel Butt wrote:
> 
>>
>> On Tue, Mar 22, 2016 at 6:55 AM, Xishi Qiu <qiuxishi@huawei.com <mailto:qiuxishi@huawei.com>> 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
> 

Hi Shakeel,

I misunderstand your meaning before. I know the reason now.

Thanks,
Xishi Qiu 

> Hi Shakeel,
> 
> I malloc and memset 10M, then sleep. It seems that the problem is still exist,
> the kernel version is v4.1
>

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[RFC] mm: why cat /proc/pid/smaps | grep Rss is different from cat  /proc/pid/statm? Xishi Qiu <qiuxishi@huawei.com> - 2016-03-22 15:00 +0100
  Re: [RFC] mm: why cat /proc/pid/smaps | grep Rss is different from  cat /proc/pid/statm? Xishi Qiu <qiuxishi@huawei.com> - 2016-03-30 09:20 +0200
    Re: [RFC] mm: why cat /proc/pid/smaps | grep Rss is different from  cat /proc/pid/statm? Xishi Qiu <qiuxishi@huawei.com> - 2016-03-30 11:50 +0200

csiph-web