Source-Changes-HG archive

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

[src/trunk]: src/sys Remove obsolete ltsleep(9) and wakeup_one(9).



details:   https://anonhg.NetBSD.org/src/rev/42ccdea305ff
branches:  trunk
changeset: 773123:42ccdea305ff
user:      rmind <rmind%NetBSD.org@localhost>
date:      Sat Jan 28 12:22:33 2012 +0000

description:
Remove obsolete ltsleep(9) and wakeup_one(9).

diffstat:

 sys/kern/kern_sleepq.c              |   6 ++--
 sys/kern/kern_synch.c               |  50 +++--------------------------------
 sys/rump/librump/rumpkern/ltsleep.c |  51 +++++++-----------------------------
 sys/sys/proc.h                      |   9 +-----
 4 files changed, 20 insertions(+), 96 deletions(-)

diffs (282 lines):

diff -r bc899c12654a -r 42ccdea305ff sys/kern/kern_sleepq.c
--- a/sys/kern/kern_sleepq.c    Sat Jan 28 12:21:13 2012 +0000
+++ b/sys/kern/kern_sleepq.c    Sat Jan 28 12:22:33 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sleepq.c,v 1.44 2011/10/31 12:18:32 yamt Exp $    */
+/*     $NetBSD: kern_sleepq.c,v 1.45 2012/01/28 12:22:33 rmind Exp $   */
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.44 2011/10/31 12:18:32 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.45 2012/01/28 12:22:33 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -54,7 +54,7 @@
 
 static int     sleepq_sigtoerror(lwp_t *, int);
 
-/* General purpose sleep table, used by ltsleep() and condition variables. */
+/* General purpose sleep table, used by mtsleep() and condition variables. */
 sleeptab_t     sleeptab        __cacheline_aligned;
 
 /*
diff -r bc899c12654a -r 42ccdea305ff sys/kern/kern_synch.c
--- a/sys/kern/kern_synch.c     Sat Jan 28 12:21:13 2012 +0000
+++ b/sys/kern/kern_synch.c     Sat Jan 28 12:22:33 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_synch.c,v 1.296 2011/11/06 14:11:00 dholland Exp $        */
+/*     $NetBSD: kern_synch.c,v 1.297 2012/01/28 12:22:33 rmind Exp $   */
 
 /*-
  * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.296 2011/11/06 14:11:00 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.297 2012/01/28 12:22:33 rmind Exp $");
 
 #include "opt_kstack.h"
 #include "opt_perfctrs.h"
@@ -176,28 +176,19 @@
  * signal needs to be delivered, ERESTART is returned if the current system
  * call should be restarted if possible, and EINTR is returned if the system
  * call should be interrupted by the signal (return EINTR).
- *
- * The interlock is held until we are on a sleep queue. The interlock will
- * be locked before returning back to the caller unless the PNORELOCK flag
- * is specified, in which case the interlock will always be unlocked upon
- * return.
  */
 int
-ltsleep(wchan_t ident, pri_t priority, const char *wmesg, int timo,
-       volatile struct simplelock *interlock)
+tsleep(wchan_t ident, pri_t priority, const char *wmesg, int timo)
 {
        struct lwp *l = curlwp;
        sleepq_t *sq;
        kmutex_t *mp;
-       int error;
 
        KASSERT((l->l_pflag & LP_INTR) == 0);
        KASSERT(ident != &lbolt);
 
        if (sleepq_dontsleep(l)) {
                (void)sleepq_abort(NULL, 0);
-               if ((priority & PNORELOCK) != 0)
-                       simple_unlock(interlock);
                return 0;
        }
 
@@ -205,18 +196,7 @@
        sq = sleeptab_lookup(&sleeptab, ident, &mp);
        sleepq_enter(sq, l, mp);
        sleepq_enqueue(sq, ident, wmesg, &sleep_syncobj);
-
-       if (interlock != NULL) {
-               KASSERT(simple_lock_held(interlock));
-               simple_unlock(interlock);
-       }
-
-       error = sleepq_block(timo, priority & PCATCH);
-
-       if (interlock != NULL && (priority & PNORELOCK) == 0)
-               simple_lock(interlock);
- 
-       return error;
+       return sleepq_block(timo, priority & PCATCH);
 }
 
 int
@@ -245,7 +225,7 @@
 
        if ((priority & PNORELOCK) == 0)
                mutex_enter(mtx);
- 
+
        return error;
 }
 
@@ -318,26 +298,6 @@
 }
 
 /*
- * OBSOLETE INTERFACE
- *
- * Make the highest priority LWP first in line on the specified
- * identifier runnable.
- */
-void 
-wakeup_one(wchan_t ident)
-{
-       sleepq_t *sq;
-       kmutex_t *mp;
-
-       if (__predict_false(cold))
-               return;
-
-       sq = sleeptab_lookup(&sleeptab, ident, &mp);
-       sleepq_wake(sq, ident, 1, mp);
-}
-
-
-/*
  * General yield call.  Puts the current LWP back on its run queue and
  * performs a voluntary context switch.  Should only be called when the
  * current LWP explicitly requests it (eg sched_yield(2)).
diff -r bc899c12654a -r 42ccdea305ff sys/rump/librump/rumpkern/ltsleep.c
--- a/sys/rump/librump/rumpkern/ltsleep.c       Sat Jan 28 12:21:13 2012 +0000
+++ b/sys/rump/librump/rumpkern/ltsleep.c       Sat Jan 28 12:22:33 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ltsleep.c,v 1.28 2010/12/01 14:59:38 pooka Exp $       */
+/*     $NetBSD: ltsleep.c,v 1.29 2012/01/28 12:22:33 rmind Exp $       */
 
 /*
  * Copyright (c) 2009, 2010 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 /*
- * Implementation of the ltsleep/mtsleep kernel sleep interface.  There
+ * Implementation of the tsleep/mtsleep kernel sleep interface.  There
  * are two sides to our implementation.  For historic spinlocks we
  * assume the kernel is giantlocked and use kernel giantlock as the
  * wait interlock.  For mtsleep, we use the interlock supplied by
@@ -34,13 +34,12 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ltsleep.c,v 1.28 2010/12/01 14:59:38 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ltsleep.c,v 1.29 2012/01/28 12:22:33 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
 #include <sys/proc.h>
 #include <sys/queue.h>
-#include <sys/simplelock.h>
 
 #include <rump/rumpuser.h>
 
@@ -123,14 +122,10 @@
 }
 
 int
-ltsleep(wchan_t ident, pri_t prio, const char *wmesg, int timo,
-       volatile struct simplelock *slock)
+tsleep(wchan_t ident, pri_t prio, const char *wmesg, int timo)
 {
        int rv, nlocks;
 
-       if (slock)
-               simple_unlock(slock);
-
        /*
         * Since we cannot use slock as the rumpuser interlock,
         * require that everyone using this prehistoric interface
@@ -142,15 +137,11 @@
        rv = sleeper(ident, timo, NULL);
        rump_kernel_bigunwrap(nlocks);
 
-       if (slock && (prio & PNORELOCK) == 0)
-               simple_lock(slock);
-
        return rv;
 }
 
 int
-mtsleep(wchan_t ident, pri_t prio, const char *wmesg, int timo,
-       kmutex_t *lock)
+mtsleep(wchan_t ident, pri_t prio, const char *wmesg, int timo, kmutex_t *lock)
 {
        int rv;
 
@@ -161,26 +152,18 @@
        return rv;
 }
 
-static void
-do_wakeup(wchan_t ident, bool wakeup_all)
+void
+wakeup(wchan_t ident)
 {
        struct ltsleeper *ltsp;
 
        rumpuser_mutex_enter_nowrap(qlock);
        LIST_FOREACH(ltsp, &sleepers, entries) {
                if (ltsp->id == ident) {
-                       if (wakeup_all) {
-                               if (ltsp->iskwait) {
-                                       cv_broadcast(&ltsp->kcv);
-                               } else {
-                                       rumpuser_cv_broadcast(ltsp->ucv);
-                               }
+                       if (ltsp->iskwait) {
+                               cv_broadcast(&ltsp->kcv);
                        } else {
-                               if (ltsp->iskwait) {
-                                       cv_signal(&ltsp->kcv);
-                               } else {
-                                       rumpuser_cv_signal(ltsp->ucv);
-                               }
+                               rumpuser_cv_broadcast(ltsp->ucv);
                        }
                }
        }
@@ -188,20 +171,6 @@
 }
 
 void
-wakeup(wchan_t ident)
-{
-
-       do_wakeup(ident, true);
-}
-
-void
-wakeup_one(wchan_t ident)
-{
-
-       do_wakeup(ident, false);
-}
-
-void
 rump_tsleep_init()
 {
 
diff -r bc899c12654a -r 42ccdea305ff sys/sys/proc.h
--- a/sys/sys/proc.h    Sat Jan 28 12:21:13 2012 +0000
+++ b/sys/sys/proc.h    Sat Jan 28 12:22:33 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: proc.h,v 1.313 2012/01/05 15:19:53 reinoud Exp $       */
+/*     $NetBSD: proc.h,v 1.314 2012/01/28 12:22:33 rmind Exp $ */
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -466,10 +466,9 @@
 void   proc_sessrele(struct session *);
 void   fixjobc(struct proc *, struct pgrp *, int);
 
-int    ltsleep(wchan_t, pri_t, const char *, int, volatile struct simplelock *);
+int    tsleep(wchan_t, pri_t, const char *, int);
 int    mtsleep(wchan_t, pri_t, const char *, int, kmutex_t *);
 void   wakeup(wchan_t);
-void   wakeup_one(wchan_t);
 int    kpause(const char *, bool, int, kmutex_t *);
 void   exit1(struct lwp *, int) __dead;
 int    do_sys_wait(int *, int *, int, struct rusage *);
@@ -532,10 +531,6 @@
                ((var) = _proclist_skipmarker(var)) != NULL;            \
                (var) = LIST_NEXT(var, p_list))
 
-/* Compatibility with old, non-interlocked tsleep call */
-#define        tsleep(chan, pri, wmesg, timo)                                  \
-       ltsleep(chan, pri, wmesg, timo, NULL)
-
 #ifdef KSTACK_CHECK_MAGIC
 void   kstack_setup_magic(const struct lwp *);
 void   kstack_check_magic(const struct lwp *);



Home | Main Index | Thread Index | Old Index