Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/rump/librump/rumpkern If we are "unsleepable" due to a d...



details:   https://anonhg.NetBSD.org/src/rev/c02f437b1388
branches:  trunk
changeset: 761461:c02f437b1388
user:      pooka <pooka%NetBSD.org@localhost>
date:      Fri Jan 28 17:04:39 2011 +0000

description:
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.

diffstat:

 sys/rump/librump/rumpkern/locks.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r 48e23027cd7a -r c02f437b1388 sys/rump/librump/rumpkern/locks.c
--- a/sys/rump/librump/rumpkern/locks.c Fri Jan 28 16:58:27 2011 +0000
+++ b/sys/rump/librump/rumpkern/locks.c Fri Jan 28 17:04:39 2011 +0000
@@ -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;
        }
 



Home | Main Index | Thread Index | Old Index