Subject: Re: more on exit performance
To: David Laight <david@l8s.co.uk>
From: Chuck Silvers <chuq@chuq.com>
List: tech-perform
Date: 11/05/2003 06:59:55
On Tue, Nov 04, 2003 at 06:37:21PM +0000, David Laight wrote:
> > find_stopped_child() walks a linked-list of the proc's children.
> > there are several ways to improve this:
> > 
> >  (2) for (pid == -1), we can keep the stopped and dead children on
> >      separate lists, and only look at the list(s) that we care about.
> 
> The p_sibling list isn't used (much) so having a second list of
> children in state SSTOP/SZOMB linking through p_sibling, but
> with a different head is a possibility.

that's what I was thinking of, yea.


> The only difficulty is kern_ktrace.c:ktrsetchildren which is carefully
> non-recursive at the moment.
> I don't think it is possible to traverse two sibling lists no-recursively!

to deal with this particular problem, we could put only zombie children
on the separate list and leave stopped and other children together.
ktrsetchildren() would only need to look at the non-zombie list since
zombie processes won't generate any more ktrace events.

then if we keep all the stopped children on the front of their list,
we can find any stopped children quickly as well.

-Chuck