Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Dec 2016 12:39:35 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r310962 - stable/11/sys/kern
Message-ID:  <201612311239.uBVCdZ1s080206@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Sat Dec 31 12:39:34 2016
New Revision: 310962
URL: https://svnweb.freebsd.org/changeset/base/310962

Log:
  MFC r305482:
  
      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

Modified:
  stable/11/sys/kern/kern_condvar.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_condvar.c
==============================================================================
--- stable/11/sys/kern/kern_condvar.c	Sat Dec 31 12:39:15 2016	(r310961)
+++ stable/11/sys/kern/kern_condvar.c	Sat Dec 31 12:39:34 2016	(r310962)
@@ -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.



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