Subject: Re: Speeding up fork/wait path
To: Jaromir Dolecek <>
From: David Laight <>
List: tech-kern
Date: 11/05/2003 18:12:43
> Exiting process now:
> 1. pmap_deactivate()s the address space and frees the vmspace
> 2. runs cpu_wait() (tears down TSS on i386 & amd64)
> 3. makes the process SZOMB
> 4. keeps KERNEL_PROC_LOCK()
> lwp_exit2() now does all post-dead lwp cleanup, including 'freeing' u-area,
> and unlocks KERNEL_PROC_LOCK() if result of process exit.
> There is no deadlwp/zomblwp list anymore. uvm_uarea_free() now merely
> links the 'freed' u-area to a list, it never calls uvm_km_free().
> exit2() is deleted, lwp_exit2() is always called for either
> 'lwp' or 'process' exit.

Any thoughts on how to make this properly MP safe?

If nothing else you need to ensure the kernel stack isn't allocated
to another process until the dying process has been switched out.

You also need to ensure that the parent isn't scheduled/running on
another cpu and reaps the zombie before you've finished the teardown.


David Laight: