Re: [RFC] fs, proc: Introduce /proc/<pid>/task/<tid>/children entryv6
From: Cyrill Gorcunov
Date: Wed Jan 18 2012 - 04:43:32 EST
On Tue, Jan 17, 2012 at 04:38:27PM -0500, KOSAKI Motohiro wrote:
> (1/16/12 10:32 AM), Cyrill Gorcunov wrote:
> >When we do checkpoint of a task we need to know the list of children
> >the task, has but there is no easy and fast way to generate reverse
> >parent->children chain from arbitrary<pid> (while a parent pid is
> >provided in "PPid" field of /proc/<pid>/status).
> >
> >So instead of walking over all pids in the system (creating one big process
> >tree in memory, just to figure out which children a task has) -- we add
> >explicit /proc/<pid>/task/<tid>/children entry, because the kernel already has
> >this kind of information but it is not yet exported.
>
> I doubt this is good idea. It move some complexity to userland, but not reduce.
> Again, if we add this interface, it should help pstree like process traversal
> tools. Bare task hierarchy shouldn't be exposed userland. I believe users need
> sub process, not sub threads.
>
Which exactly complexity it moves to user-space? You have some task, and now
you can find all children easily, what the complexity you're talking about?
pstree is building the whole process tree going through all entries in
/proc/<pid>, reading PPid field and then forming the topology. I would like
to be able to find children faster. So I readdir a /proc/<pid>/task/ and
the walk over every /proc/<pid>/task/<tid>/children. This helps alot.
Cyrill
--
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/