Subject: Re: Final reaper removal patch
To: None <jdolecek@NetBSD.org>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 02/08/2004 00:50:22
hi,

> > during it's holding a spinlock,
> > an interrupt which acquire kernel lock can occur.
> > 
> > an alternative solution, which is preferred of course, is
> > making all interrupt handlers biglock-free. :-)
> 
> Indeed, thank you. I'll look at it soon.
> 
> Jaromir 

is it ok to commit the following diff for now?

YAMAMOTO Takashi

Index: kern_lwp.c
===================================================================
--- kern_lwp.c	(revision 516)
+++ kern_lwp.c	(revision 517)
@@ -596,6 +596,7 @@ lwp_exit2(struct lwp *l)
 {
 	struct proc *p;
 
+	KERNEL_LOCK(LK_EXCLUSIVE);
 	/*
 	 * Free the VM resources we're still holding on to.
 	 */
@@ -612,9 +613,11 @@ lwp_exit2(struct lwp *l)
 		}
 
 		pool_put(&lwp_pool, l);
+		KERNEL_UNLOCK();
 	} else {
 		p = l->l_proc;
 		p->p_nzlwps++;
+		KERNEL_UNLOCK();
 		wakeup(&p->p_nlwps);
 	}
 }