Re: [PATCH] processes with shared vm
Terje Eggestad (terje.eggestad@scali.no)
17 Aug 2001 10:46:59 +0200
Den 17 Aug 2001 10:21:35 +0200, skrev Andi Kleen:
> Terje Eggestad <terje.eggestad@scali.no> writes:
>
> > I figured out that it's difficult to find out from /proc
> > which processes that share VM (created with clone(CLONE_VM)).
> >
> > made a patch that adds in /proc/<pid>/status a VmClones field that tells
> > how many proc that uses the same VM (mm_struct). if there are clones I
> > add another field VmFirstClone with the pid of clone with the lowest
> > pid.
> >
> > Needed for things like gtop that adds mem usage of groups of proc, or
> > else they add up the usage of SIZE and RSS of threads.
> >
> > The patch need to be applied to linux/fs/proc/array.c
>
> The basic idea is a good one (I have written a similar thing in the past ;)
> Your implementation is O(n^2) however in ps, which is not acceptable.
> Much better is it to add a new field to mm_struct that gets initialised
> on first creation with the pid, and adding a place holder in pid hash
> if that process goes away and the mm_struct is still there to avoid pid
> reuse (or alternatively link task_structs to mms and always use the pid of
> the first entry)
>
> -Andi
Thought of all that, yes ps will have O(n^2) BUT ONLY FOR CLONED PROCS.
How many cloned procs do you usually have????
Even if I agree that there should be a linked list of all the cloned
procs, it means major changes to the data structs in the kernel.
With the number of threaded programs out there, this is "good enough".
TJ
--
_________________________________________________________________________
Terje Eggestad terje.eggestad@scali.no
Scali Scalable Linux Systems http://www.scali.com
Olaf Helsets Vei 6 tel: +47 22 62 89 61 (OFFICE)
P.O.Box 70 Bogerud +47 975 31 574 (MOBILE)
N-0621 Oslo fax: +47 22 62 89 51
NORWAY
_________________________________________________________________________
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/