cv: do a lockless check for no waiters in cv_signal and cv_broadcastpri

In case of some consumers like zfs there are no waiters vast majority of
the time

Reviewed by:	jhb
MFC after:	1 week
This commit is contained in:
Mateusz Guzik 2016-09-06 17:16:59 +00:00
parent 949b56ba66
commit 5b7d9ae2fd

View File

@ -397,6 +397,8 @@ cv_signal(struct cv *cvp)
{
int wakeup_swapper;
if (cvp->cv_waiters == 0)
return;
wakeup_swapper = 0;
sleepq_lock(cvp);
if (cvp->cv_waiters > 0) {
@ -424,6 +426,8 @@ cv_broadcastpri(struct cv *cvp, int pri)
{
int wakeup_swapper;
if (cvp->cv_waiters == 0)
return;
/*
* XXX sleepq_broadcast pri argument changed from -1 meaning
* no pri to 0 meaning no pri.