Re: How to find out how many other processes share VM with $PID?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


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?
> > >
> > >
> > > Another helpful patch could be:
> > >         maps: PSS(proportional set size) accounting in smaps
> > >
> >
> > 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(&current->mm->mm_users).

What name do you like? 

SharedVmCount: N
VmUsers: N

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at
Please read the FAQ at

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux