From: Xishi Qiu <qiuxishi@huawei.com>
To: Shakeel Butt <shakeelb@google.com>
Cc: Linux MM <linux-mm@kvack.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] mm: why cat /proc/pid/smaps | grep Rss is different from cat /proc/pid/statm?
Date: Wed, 30 Mar 2016 17:39:47 +0800 [thread overview]
Message-ID: <56FB9EE3.7010208@huawei.com> (raw)
In-Reply-To: <56FB7D37.5070503@huawei.com>
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
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2016-03-30 9:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-22 13:55 [RFC] mm: why cat /proc/pid/smaps | grep Rss is different from cat /proc/pid/statm? Xishi Qiu
2016-03-22 14:47 ` Shakeel Butt
2016-03-30 7:16 ` Xishi Qiu
2016-03-30 9:39 ` Xishi Qiu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56FB9EE3.7010208@huawei.com \
--to=qiuxishi@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shakeelb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).