Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Jun 2015 06:12:14 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r284719 - head/sys/kern
Message-ID:  <201506230612.t5N6CELN019311@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Jun 23 06:12:14 2015
New Revision: 284719
URL: https://svnweb.freebsd.org/changeset/base/284719

Log:
  Only take previous buffer queue lock (olock) when needed for REMFREE
  in binsfree().
  
  Submitted by:	Conrad Meyer
  Sponsored by:	EMC / Isilon Storage Division
  Review:	https://reviews.freebsd.org/D2882
  MFC after:	1 week

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c	Tue Jun 23 05:55:13 2015	(r284718)
+++ head/sys/kern/vfs_bio.c	Tue Jun 23 06:12:14 2015	(r284719)
@@ -994,21 +994,23 @@ binsfree(struct buf *bp, int qindex)
 
 	BUF_ASSERT_XLOCKED(bp);
 
-	olock = bqlock(bp->b_qindex);
 	nlock = bqlock(qindex);
-	mtx_lock(olock);
 	/* Handle delayed bremfree() processing. */
-	if (bp->b_flags & B_REMFREE)
+	if (bp->b_flags & B_REMFREE) {
+		olock = bqlock(bp->b_qindex);
+		mtx_lock(olock);
 		bremfreel(bp);
+		if (olock != nlock) {
+			mtx_unlock(olock);
+			mtx_lock(nlock);
+		}
+	} else
+		mtx_lock(nlock);
 
 	if (bp->b_qindex != QUEUE_NONE)
 		panic("binsfree: free buffer onto another queue???");
 
 	bp->b_qindex = qindex;
-	if (olock != nlock) {
-		mtx_unlock(olock);
-		mtx_lock(nlock);
-	}
 	if (bp->b_flags & B_AGE)
 		TAILQ_INSERT_HEAD(&bufqueues[bp->b_qindex], bp, b_freelist);
 	else



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