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

This commit is contained in:
rmind 2012-01-28 12:22:33 +00:00
parent 30250d8bed
commit 9a80847a9f
4 changed files with 20 additions and 96 deletions

View File

@ -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.c,v 1.44 2011/10/31 12:18:32 yamt Exp $"
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;
/*

View File

@ -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, const char *wmesg, int timo,
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, const char *wmesg, int timo,
if ((priority & PNORELOCK) == 0)
mutex_enter(mtx);
return error;
}
@ -317,26 +297,6 @@ wakeup(wchan_t ident)
sleepq_wake(sq, ident, (u_int)-1, mp);
}
/*
* 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

View File

@ -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_t *kinterlock)
}
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 char *wmesg, int timo,
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,46 +152,24 @@ mtsleep(wchan_t ident, pri_t prio, const char *wmesg, int timo,
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);
}
}
}
rumpuser_mutex_exit(qlock);
}
void
wakeup(wchan_t ident)
{
do_wakeup(ident, true);
}
void
wakeup_one(wchan_t ident)
{
do_wakeup(ident, false);
}
void
rump_tsleep_init()
{

View File

@ -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 *);