Ressurect cv_wakeup() and use it on lbolt. Should fix PR kern/36714.

(background/foreground signal lossage in -current with various programs).
This commit is contained in:
ad 2007-08-01 23:21:14 +00:00
parent 08f66ef435
commit fe1b7cd1f7
3 changed files with 29 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_condvar.c,v 1.10 2007/08/01 20:30:38 ad Exp $ */
/* $NetBSD: kern_condvar.c,v 1.11 2007/08/01 23:21:14 ad Exp $ */
/*-
* Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_condvar.c,v 1.10 2007/08/01 20:30:38 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_condvar.c,v 1.11 2007/08/01 23:21:14 ad Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@ -342,6 +342,27 @@ cv_broadcast(kcondvar_t *cv)
sleepq_unlock(sq);
}
/*
* cv_wakeup:
*
* Wake all LWPs waiting on a condition variable. For cases
* where the address may be waited on by mtsleep()/tsleep().
* Not a documented call.
*/
void
cv_wakeup(kcondvar_t *cv)
{
sleepq_t *sq;
u_int cnt;
sq = sleeptab_lookup(&sleeptab, cv);
if ((cnt = cv->cv_waiters) != 0) {
cv->cv_waiters = 0;
sleepq_wake(sq, cv, cnt);
} else
sleepq_unlock(sq);
}
/*
* cv_has_waiters:
*

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_synch.c,v 1.190 2007/07/09 21:10:54 ad Exp $ */
/* $NetBSD: kern_synch.c,v 1.191 2007/08/01 23:21:15 ad Exp $ */
/*-
* Copyright (c) 1999, 2000, 2004, 2006, 2007 The NetBSD Foundation, Inc.
@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.190 2007/07/09 21:10:54 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.191 2007/08/01 23:21:15 ad Exp $");
#include "opt_kstack.h"
#include "opt_lockdebug.h"
@ -908,7 +908,7 @@ sched_pstats(void *arg)
}
mutex_exit(&proclist_mutex);
uvm_meter();
cv_broadcast(&lbolt);
cv_wakeup(&lbolt);
callout_schedule(&sched_pstats_ch, hz);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: condvar.h,v 1.5 2007/07/09 21:11:32 ad Exp $ */
/* $NetBSD: condvar.h,v 1.6 2007/08/01 23:21:14 ad Exp $ */
/*-
* Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
@ -66,6 +66,8 @@ int cv_timedwait_sig(kcondvar_t *, kmutex_t *, int);
void cv_signal(kcondvar_t *);
void cv_broadcast(kcondvar_t *);
void cv_wakeup(kcondvar_t *);
bool cv_has_waiters(kcondvar_t *);
/* The "lightning bolt", awoken once per second by the clock interrupt. */