Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Oct 2014 15:35:47 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r273549 - head/sys/kern
Message-ID:  <201410231535.s9NFZlbn002656@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Thu Oct 23 15:35:47 2014
New Revision: 273549
URL: https://svnweb.freebsd.org/changeset/base/273549

Log:
  Avoid taking the lock in selfdfree when not needed.

Modified:
  head/sys/kern/sys_generic.c

Modified: head/sys/kern/sys_generic.c
==============================================================================
--- head/sys/kern/sys_generic.c	Thu Oct 23 15:16:40 2014	(r273548)
+++ head/sys/kern/sys_generic.c	Thu Oct 23 15:35:47 2014	(r273549)
@@ -1600,10 +1600,11 @@ static void
 selfdfree(struct seltd *stp, struct selfd *sfp)
 {
 	STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link);
-	mtx_lock(sfp->sf_mtx);
-	if (sfp->sf_si)
+	if (sfp->sf_si != NULL) {
+		mtx_lock(sfp->sf_mtx);
 		TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads);
-	mtx_unlock(sfp->sf_mtx);
+		mtx_unlock(sfp->sf_mtx);
+	}
 	uma_zfree(selfd_zone, sfp);
 }
 



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