Re: [rfc 2/3] fs, proc: Introduce the Children: line in/proc/<pid>/status

From: KAMEZAWA Hiroyuki
Date: Thu Dec 01 2011 - 19:41:20 EST


On Thu, 1 Dec 2011 13:54:34 +0400
Cyrill Gorcunov <gorcunov@xxxxxxxxx> wrote:

> On Wed, Nov 30, 2011 at 10:05:37AM +0400, Cyrill Gorcunov wrote:
> > On Wed, Nov 30, 2011 at 02:00:09PM +0900, KAMEZAWA Hiroyuki wrote:
> > > On Tue, 29 Nov 2011 23:12:54 +0400
> > > Cyrill Gorcunov <gorcunov@xxxxxxxxxx> wrote:
> > >
> > > > From: Pavel Emelyanov <xemul@xxxxxxxxxxxxx>
> > > >
> > > > There is no easy way to make a reverse parent->children chain
> > > > from the task status, in turn children->parent provided with "PPid"
> > > > field.
> > > >
> > > > So instead of walking over all pids in system to figure out what
> > > > children the task have -- we add explicit "Children" member to
> > > > /proc/<pid>/status since kernel already knows this kind of information
> > > > but it was not yet exported.
> > > >
> > > > Signed-off-by: Pavel Emelyanov <xemul@xxxxxxxxxxxxx>
> > > > Acked-by: Serge Hallyn <serge.hallyn@xxxxxxxxxxxxx>
> > > > Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
> > >
> > > I may be too pessimistic but what amount of overhead will this add to
> > > ps -elf/ top ? Assuming an environment 'ps -elf' is called once per a sec,
> > > if there are 2000 processes, task_list lock is taken 2000 times by this patch.
> > >
> >
> > Hi Kame, good point! Yes, it introduces latency on high loaded systems.
> > I must admit I tested this patch on a regular system, where not that much
> > processes were launched but technically I think more correct would be to
> > switch to children file. I'll tune up the patch. Thanks!
> >
> > > Isn't it better to add /proc/<pid>/children file or dir (as task)?
> > >
> > > Thanks,
> > > -Kame
> > >
>
> What about this one?
> ---
> fs, proc: Introduce the /proc/<pid>/children entry
>
> There is no easy way to make a reverse parent->children chain
> from the task status, in turn children->parent provided with "PPid"
> field.
>
> So instead of walking over all pids in system to figure out what
> children the task have -- we add explicit /proc/<pid>/children entry,
> since kernel already knows this kind of information but it was not
> yet exported.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
> Cc: Pavel Emelyanov <xemul@xxxxxxxxxxxxx>
> Cc: Serge Hallyn <serge.hallyn@xxxxxxxxxxxxx>
> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>

Yes, I like /children file. other points seems to be pointed out by other
reviewers.

Thanks,
-Kame

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/