Module Name:    src
Committed By:   rmind
Date:           Sat Jan 28 12:22:34 UTC 2012

Modified Files:
        src/sys/kern: kern_sleepq.c kern_synch.c
        src/sys/rump/librump/rumpkern: ltsleep.c
        src/sys/sys: proc.h

Log Message:
Remove obsolete ltsleep(9) and wakeup_one(9).


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/kern/kern_sleepq.c
cvs rdiff -u -r1.296 -r1.297 src/sys/kern/kern_synch.c
cvs rdiff -u -r1.28 -r1.29 src/sys/rump/librump/rumpkern/ltsleep.c
cvs rdiff -u -r1.313 -r1.314 src/sys/sys/proc.h

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

Modified files:

Index: src/sys/kern/kern_sleepq.c
diff -u src/sys/kern/kern_sleepq.c:1.44 src/sys/kern/kern_sleepq.c:1.45
--- src/sys/kern/kern_sleepq.c:1.44	Mon Oct 31 12:18:32 2011
+++ src/sys/kern/kern_sleepq.c	Sat Jan 28 12:22:33 2012
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: kern_sleepq.
 
 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;
 
 /*

Index: src/sys/kern/kern_synch.c
diff -u src/sys/kern/kern_synch.c:1.296 src/sys/kern/kern_synch.c:1.297
--- src/sys/kern/kern_synch.c:1.296	Sun Nov  6 14:11:00 2011
+++ src/sys/kern/kern_synch.c	Sat Jan 28 12:22:33 2012
@@ -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 @@ synch_init(void)
  * 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 @@ ltsleep(wchan_t ident, pri_t priority, c
 	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 @@ mtsleep(wchan_t ident, pri_t priority, c
 
 	if ((priority & PNORELOCK) == 0)
 		mutex_enter(mtx);
- 
+
 	return error;
 }
 
@@ -318,26 +298,6 @@ wakeup(wchan_t ident)
 }
 
 /*
- * 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)).

Index: src/sys/rump/librump/rumpkern/ltsleep.c
diff -u src/sys/rump/librump/rumpkern/ltsleep.c:1.28 src/sys/rump/librump/rumpkern/ltsleep.c:1.29
--- src/sys/rump/librump/rumpkern/ltsleep.c:1.28	Wed Dec  1 14:59:38 2010
+++ src/sys/rump/librump/rumpkern/ltsleep.c	Sat Jan 28 12:22:33 2012
@@ -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 @@ sleeper(wchan_t ident, int timo, kmutex_
 }
 
 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 @@ ltsleep(wchan_t ident, pri_t prio, const
 	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 @@ mtsleep(wchan_t ident, pri_t prio, const
 	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 @@ do_wakeup(wchan_t ident, bool wakeup_all
 }
 
 void
-wakeup(wchan_t ident)
-{
-
-	do_wakeup(ident, true);
-}
-
-void
-wakeup_one(wchan_t ident)
-{
-
-	do_wakeup(ident, false);
-}
-
-void
 rump_tsleep_init()
 {
 

Index: src/sys/sys/proc.h
diff -u src/sys/sys/proc.h:1.313 src/sys/sys/proc.h:1.314
--- src/sys/sys/proc.h:1.313	Thu Jan  5 15:19:53 2012
+++ src/sys/sys/proc.h	Sat Jan 28 12:22:33 2012
@@ -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_sesshold(struct session *);
 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 @@ _proclist_skipmarker(struct proc *p0)
 		((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 *);

Reply via email to