Subject: Re: new pid allocation code
To: David Laight <>
From: Jason R Thorpe <>
List: tech-kern
Date: 03/11/2003 06:59:25
On Tue, Mar 11, 2003 at 02:36:30PM +0000, David Laight wrote:

 > The main benefits are:
 > - pid and pgrp lookup (by id) doesn't require a search
 > - no dependency on MAXUSERS
 > - automatically scales well to large numbers of processes
 > - small data footprint for small systems
 > - ability to enumerate through all the processes without holding a lock
 >   for the entire duration, or having very messy locking rules.
 >   (the allproc list and p_list fields could be depracted later).
 > - Largely MP clean

Pretty cool.  Have you done any benchmarks to see if the improved lookup
algorithm has a noticeable impact?

 > (I've been running this code for months!)

A couple of comments:

	* Please see /usr/share/misc/style regarding formatting of
	  comments :-)

	* Don't use MALLOC()/FREE() for variable-sized allocations; use
	  malloc()/free() instead.

	* I think proc0_insert() is a better name than set_proc_0().

All in all, looks good.  But can you explain how the deadproc linkage
works in the new scheme?  (Since you didn't post all of those changes...)

        -- Jason R. Thorpe <>