public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 1/2]block: change force plug flush call order
@ 2011-08-24  8:55 Shaohua Li
  2011-08-24 13:59 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Shaohua Li @ 2011-08-24  8:55 UTC (permalink / raw)
  To: Jens Axboe; +Cc: lkml

Do blk_flush_plug_list() first and then add new request at the tail. New
request can't be merged to existing requests, but later new requests might
be merged with this new one. If blk_flush_plug_list() is done later, the
merge doesn't happen.
Believe it or not, this fixes a 10% regression running sysbench workload.

Signed-off-by: Shaohua Li <shli@kernel.org>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
---
 block/blk-core.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: linux/block/blk-core.c
===================================================================
--- linux.orig/block/blk-core.c	2011-08-24 16:09:39.000000000 +0800
+++ linux/block/blk-core.c	2011-08-24 16:13:20.000000000 +0800
@@ -1302,11 +1302,11 @@ get_rq:
 			if (__rq->q != q)
 				plug->should_sort = 1;
 		}
-		list_add_tail(&req->queuelist, &plug->list);
-		plug->count++;
-		drive_stat_acct(req, 1);
 		if (plug->count >= BLK_MAX_REQUEST_COUNT)
 			blk_flush_plug_list(plug, false);
+		plug->count++;
+		list_add_tail(&req->queuelist, &plug->list);
+		drive_stat_acct(req, 1);
 	} else {
 		spin_lock_irq(q->queue_lock);
 		add_acct_request(q, req, where);



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch 1/2]block: change force plug flush call order
  2011-08-24  8:55 [patch 1/2]block: change force plug flush call order Shaohua Li
@ 2011-08-24 13:59 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2011-08-24 13:59 UTC (permalink / raw)
  To: Shaohua Li; +Cc: lkml

On 2011-08-24 10:55, Shaohua Li wrote:
> Do blk_flush_plug_list() first and then add new request at the tail. New
> request can't be merged to existing requests, but later new requests might
> be merged with this new one. If blk_flush_plug_list() is done later, the
> merge doesn't happen.
> Believe it or not, this fixes a 10% regression running sysbench workload.

Heh, funky. But conceptually it makes sense to flush first, since we
already know that this request isn't mergeable already. Applied.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-24 13:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-24  8:55 [patch 1/2]block: change force plug flush call order Shaohua Li
2011-08-24 13:59 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox