Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Jun 2015 05:53:15 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r284944 - stable/10/sys/kern
Message-ID:  <201506300553.t5U5rFUI053723@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Jun 30 05:53:15 2015
New Revision: 284944
URL: https://svnweb.freebsd.org/changeset/base/284944

Log:
  MFC r284719:
  Only take previous buffer queue lock (olock) when needed for REMFREE
  in binsfree().

Modified:
  stable/10/sys/kern/vfs_bio.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/vfs_bio.c
==============================================================================
--- stable/10/sys/kern/vfs_bio.c	Tue Jun 30 00:51:43 2015	(r284943)
+++ stable/10/sys/kern/vfs_bio.c	Tue Jun 30 05:53:15 2015	(r284944)
@@ -963,21 +963,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?201506300553.t5U5rFUI053723>