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 * wrap tsleep functions to drop di...



details:   https://anonhg.NetBSD.org/src/rev/5d16e35aabd3
branches:  trunk
changeset: 747153:5d16e35aabd3
user:      pooka <pooka%NetBSD.org@localhost>
date:      Fri Sep 04 13:58:57 2009 +0000

description:
* wrap tsleep functions to drop die grosslock since we're going to
  sleep anyway in a few flicks from the clock
* broadcast instead of signal in wakeup()

diffstat:

 sys/rump/librump/rumpkern/ltsleep.c |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (63 lines):

diff -r bd8212fe2ed2 -r 5d16e35aabd3 sys/rump/librump/rumpkern/ltsleep.c
--- a/sys/rump/librump/rumpkern/ltsleep.c       Fri Sep 04 13:02:52 2009 +0000
+++ b/sys/rump/librump/rumpkern/ltsleep.c       Fri Sep 04 13:58:57 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ltsleep.c,v 1.14 2009/06/09 23:26:19 pooka Exp $       */
+/*     $NetBSD: ltsleep.c,v 1.15 2009/09/04 13:58:57 pooka Exp $       */
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ltsleep.c,v 1.14 2009/06/09 23:26:19 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ltsleep.c,v 1.15 2009/09/04 13:58:57 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -56,6 +56,9 @@
        volatile struct simplelock *slock)
 {
        struct ltsleeper lts;
+       int nlocks;
+
+       KERNEL_UNLOCK_ALL(curlwp, &nlocks);
 
        lts.id = ident;
        cv_init(&lts.cv, NULL);
@@ -76,6 +79,7 @@
        if (slock && (prio & PNORELOCK) == 0)
                simple_lock(slock);
 
+       KERNEL_LOCK(nlocks, curlwp);
        return 0;
 }
 
@@ -84,6 +88,9 @@
        kmutex_t *lock)
 {
        struct ltsleeper lts;
+       int nlocks;
+
+       KERNEL_UNLOCK_ALL(curlwp, &nlocks);
 
        lts.id = ident;
        cv_init(&lts.cv, NULL);
@@ -103,6 +110,7 @@
        if ((prio & PNORELOCK) == 0)
                mutex_enter(lock);
 
+       KERNEL_LOCK(nlocks, curlwp);
        return 0;
 }
 
@@ -114,7 +122,7 @@
        mutex_enter(&sleepermtx);
        LIST_FOREACH(ltsp, &sleepers, entries)
                if (ltsp->id == ident)
-                       cv_signal(&ltsp->cv);
+                       cv_broadcast(&ltsp->cv);
        mutex_exit(&sleepermtx);
 }
 



Home | Main Index | Thread Index | Old Index