Subject: CVS commit: [vmlocking] src/sys
To: None <source-changes@NetBSD.org>
From: YAMAMOTO Takashi <yamt@netbsd.org>
List: source-changes
Date: 08/19/2007 22:10:15
Module Name:	src
Committed By:	yamt
Date:		Sun Aug 19 22:10:15 UTC 2007

Modified Files:
	src/sys/kern [vmlocking]: kern_exit.c kern_proc.c
	src/sys/sys [vmlocking]: proc.h

Log Message:
proc_free: release proclist_lock earlier as suggested by Andrew Doran.
calling lwp_free with the lock held leads a deadlock.

    1. CPU1: do_sys_wait -> lwp_free busy-waits for an LWP exiting on CPU2,
     holding proclist_lock.

    2. CPU2: the exiting LWP is interrupted by softclock.

    3. CPU2: softclock -> sched_pstats tries to acquire proclist_lock.
     it also busy-waits because the owning LWP is running.


To generate a diff of this commit:
cvs rdiff -r1.169.2.10 -r1.169.2.11 src/sys/kern/kern_exit.c
cvs rdiff -r1.107.2.11 -r1.107.2.12 src/sys/kern/kern_proc.c
cvs rdiff -r1.243.2.4 -r1.243.2.5 src/sys/sys/proc.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.