Module Name:    src
Committed By:   pooka
Date:           Fri Jan 28 17:04:39 UTC 2011

Modified Files:
        src/sys/rump/librump/rumpkern: locks.c

Log Message:
If we are "unsleepable" due to a dying proc, yield() instead of
returning directly.  This allows other threads to run possible
setting a condition we are waiting on.

Fixes a busyloop condition which could be entered from vfs_unmountall()
where we were waiting for vrele_pending and the vrele thread could
not run since we were hogging the CPU.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/rump/librump/rumpkern/locks.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/locks.c
diff -u src/sys/rump/librump/rumpkern/locks.c:1.49 src/sys/rump/librump/rumpkern/locks.c:1.50
--- src/sys/rump/librump/rumpkern/locks.c:1.49	Fri Jan 28 16:58:28 2011
+++ src/sys/rump/librump/rumpkern/locks.c	Fri Jan 28 17:04:39 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: locks.c,v 1.49 2011/01/28 16:58:28 pooka Exp $	*/
+/*	$NetBSD: locks.c,v 1.50 2011/01/28 17:04:39 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008 Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.49 2011/01/28 16:58:28 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.50 2011/01/28 17:04:39 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/kmem.h>
@@ -285,10 +285,11 @@
 
 	if (__predict_false(l->l_flag & LW_RUMP_DYING)) {
 		/*
-		 * sleepq code expects us to sleep, so set l_mutex
-		 * back to cpu lock here if we didn't.
+		 * yield() here, someone might want the cpu
+		 * to set a condition.  otherwise we'll just
+		 * loop forever.
 		 */
-		l->l_mutex = l->l_cpu->ci_schedstate.spc_mutex;
+		yield();
 		return EINTR;
 	}
 

Reply via email to