Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Mar 2006 13:52:03 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-arch@freebsd.org
Cc:        arch@freebsd.org, Poul-Henning Kamp <phk@phk.freebsd.dk>
Subject:   Re: wakeup idea...
Message-ID:  <200603061352.05452.jhb@freebsd.org>
In-Reply-To: <35339.1141557488@critter.freebsd.dk>
References:  <35339.1141557488@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
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@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603061352.05452.jhb>