wakeup idea...

John Baldwin jhb at freebsd.org
Mon Mar 6 10:53:25 PST 2006


On Sunday 05 March 2006 06:18, Poul-Henning Kamp wrote:
> 
> Here is a possibly stupid idea.
> 
> Historically sleep/wakeup have happened on a pointer which was just
> a magic number.
> 
> In many cases, this pointer is actually a relevant datastructure.
> 
> Would it possibly be an optimization to make a variant of the
> sleep/wakeup calls where the pointer points to an integer type which
> contains non-zero if anybody is actually sleeping on that address ?
> 
> Anybody up for a quick prototype ?

It lives in sys/kern/kern_condvar.c

void
cv_signal(struct cv *cvp)
{

	sleepq_lock(cvp);
	if (cvp->cv_waiters > 0) {
		cvp->cv_waiters--;
		sleepq_signal(cvp, SLEEPQ_CONDVAR, -1);
	} else
		sleepq_release(cvp);
}

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the freebsd-arch mailing list