From: Denys Vlasenko <vda.linux@googlemail.com>
To: Fengguang Wu <wfg@mail.ustc.edu.cn>
Cc: linux-kernel@vger.kernel.org
Subject: Re: How to find out how many other processes share VM with $PID?
Date: Tue, 28 Aug 2007 21:00:41 +0100 [thread overview]
Message-ID: <200708282100.41443.vda.linux@googlemail.com> (raw)
In-Reply-To: <388259805.10631@ustc.edu.cn>
On Tuesday 28 August 2007 01:10, Fengguang Wu wrote:
> > > There is a nice LWN article on this issue:
> > > ELC: How much memory are applications really using?
> > > http://lwn.net/Articles/230975/
> > >
> > > Another helpful patch could be:
> > > maps: PSS(proportional set size) accounting in smaps
> > > http://lkml.org/lkml/2007/8/19/23
> >
> > Thanks a lot, very useful pages indeed.
> >
> > However they still don't explain how I can avoid counting memory
> > twice for /proc/PID1 and /proc/PID2 when PID2 is a child of PID1,
> > created with CLONE_VM.
> >
> > The example: I allocate 1234k, dirty it, then clone with CLONE_VM.
> > I will seemingly have two processes, each using 1234k, _privately_
> > (i.e., pages are not shown as shared in smaps) -
> > which is technically correct, pages are not shared with other VMs,
> > but they ARE shared by means of these two processes having the same VM!
> >
> > How userspace tools can figure out that these processes have shared VM?
> >
> > IOW: do we need "VMsharecount: N" in addition to "Threads: N"
> > in /proc/PID/status?
>
> A full solution would require two parameters, i.e. VmUsers/VmMagic.
>
> But please make sure the new lines won't break important tools like
> ps/top/pmaps/...
Should be safe - tools skip lines they do not recognize.
Ok, we have "Threads: N".
I can cook up a patch which adds count of processes
which share VM with us - it's just atomic_read(¤t->mm->mm_users).
What name do you like?
SharedVmCount: N
VmUsers: N
other?
--
vda
next prev parent reply other threads:[~2007-08-28 20:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-27 11:56 How to find out how many other processes share VM with $PID? Denys Vlasenko
[not found] ` <20070827121354.GA5616@mail.ustc.edu.cn>
2007-08-27 12:13 ` Fengguang Wu
2007-08-27 13:26 ` Denys Vlasenko
[not found] ` <20070828001004.GA11875@mail.ustc.edu.cn>
2007-08-28 0:10 ` Fengguang Wu
2007-08-28 20:00 ` Denys Vlasenko [this message]
[not found] ` <20070829071432.GA5777@mail.ustc.edu.cn>
2007-08-29 7:14 ` Fengguang Wu
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=200708282100.41443.vda.linux@googlemail.com \
--to=vda.linux@googlemail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=wfg@mail.ustc.edu.cn \
/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