Subject: Re: new pid allocation code
To: None <tech-kern@netbsd.org>
From: Alan Barrett <apb@cequrux.com>
List: tech-kern
Date: 03/13/2003 12:33:59
On Thu, 13 Mar 2003, David Laight wrote:
> > > -	LIST_INSERT_HEAD(&deadproc, p, p_hash);
> > > +	p->p_dead = deadprocs;
> > > +	deadprocs = p;
> 
> Well the deadproc list was using the p_hash member - which no longer exists.
> Since processes only sit on the deadprocs list for a very short time,
> changing it for FIFO to LIFO isn't an issue.
> A LIFO list doesn't need any macros...

You could get LIFO behaviour with minimal overhead using an SLIST
through the p_dead member.  You could get FIFO behaviour with not much
more overhead by using an STAILQ (inserting at the tail and removing
from the head).

> For a readability point of view I find the 'hand-coded pointer
> manipulation' better than the list macros.

That's a matter of taste.  For single linked lists that many people
could implement in their sleep, I can understand the desire to avoid
the list macros.  But the macros make it easier to change the data
structure, to add debugging, and to audit the code.

Is there a policy on the use of list macros?

--apb (Alan Barrett)