Re: init's children list is long and slows reaping children.

Ingo Molnar
2007-04-06T17:27:46Z

* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> I'd almost prefer to just not add kernel threads to any parent process
> list *at*all*.

i think part of the problem is the legacy that the list is artificially
unified: tasks that 'will possibly exit' are on the same list as tasks
that 'have already exited'. If we split it up into its natural data
structure, having a list of tasks that are there and do not intend to
exit, plus a separate list of tasks that are exiting and want to notify
their parent, all this scanning goes away. I can see no real reason for
this other than legacy - i dont think the semantics of the wait4() API
force us to scan all those threads.

putting the freshly reaped tasks at the 'head' of the list is just a
fancy (and incomplete) way of splitting the list up into two lists, and
i'd advocate a clean split. Just like have have split the ptrace_list
away from the main list too.

Ingo