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

From: Pedro Alves
Date: Fri Dec 02 2011 - 08:44:45 EST


On Friday 02 December 2011 13:16:52, Pavel Emelyanov wrote:
> On 12/02/2011 04:58 PM, Pedro Alves wrote:
> > On Friday 02 December 2011 12:43:10, Pavel Emelyanov wrote:
> >
> >>>> Yes, I like /children file. other points seems to be pointed out by other
> >>>> reviewers.
> >>>
> >>> Any reason this is a file instead of a directory like /proc/PID/task/ ?
> >>>
> >>> $ sudo ls /proc/8167/task/
> >>> 8167 854 855 856 857 858 859
> >>> $ sudo ls /proc/8167/task/855/
> >>> attr clear_refs cpuset exe io loginuid mountinfo oom_adj pagemap sched smaps statm wchan
> >>> auxv cmdline cwd fd latency maps mounts oom_score personality schedstat stack status
> >>> cgroup comm environ fdinfo limits mem numa_maps oom_score_adj root sessionid stat syscall
> >>>
> >>> Much easier to follow the chain from the command line this way.
> >>
> >> What do you propose to put into these directories? Another directories named with
> >> children pid-s?
> >
> > Yes, just like the task/ dir gives you directories named with the
> > processes's thread ids. Opening /proc/PID/children/PID-CHILD1/ would get
> > you the same as opening /proc/PID-CHILD1/. Just like
> > opening /proc/PID/task/PID-CHILD1/ gets you (almost) the same as opening
> > /proc/PID-CHILD1/.
>
> You cannot make the dentry named /proc/<pid1>/children/<pid2> be a hardlink on
> the /proc/<pid2>. Thus you have to make arbitrary amount of inodes to point to
> a single task. This brings unnecessary complexity and memory usage (by dentries
> and proc inodes).

How is this different from the _already existing_ /proc/<pid1>/task/ directory?
I can imagine that 98% of the code would be shared even? It's "just" a matter of
listing thread group children (child/), instead of clone children (task/),
isn't it?

They are not symbolic links under task/. /proc/<pid1>/task/<pid2>/ does not
have a task/ subdir, only /proc/<pid1>/ does, I guess to avoid the memory usage
issue you raise.

> I'd accept the symbolic links, but how would they look like? Like this:
> # ls -l /proc/123/children
> 234 -> ../../234
> ?

That'd work for me... but really, why not reuse tasks/'s code and
behave the same?

--
Pedro Alves
--
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/