linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]block: make auto block plug flush threshold per-disk based
@ 2012-04-06 17:27 Shaohua Li
  2012-04-06 17:39 ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Shaohua Li @ 2012-04-06 17:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: axboe


Subject: block: make auto block plug flush threshold per-disk based

We do auto block plug flush to reduce latency, the threshold is 16
requests. This works well if the task is accessing one or two drives.
The problem is if the task is accessing a raid 0 device and the raid
disk number is big, say 8 or 16, 16/8 = 2 or 16/16=1, we will have
heavy lock contention.

This patch makes the threshold per-disk based. The latency should be
still ok accessing one or two drives. The setup with application
accessing a lot of drives in the meantime uaually is big machine,
avoiding lock contention is more important, because any contention
will actually increase latency.

Signed-off-by: Shaohua Li <shli@fusionio.com>
---
  block/blk-core.c |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux/block/blk-core.c
===================================================================
--- linux.orig/block/blk-core.c	2012-04-06 10:51:29.766932123 -0600
+++ linux/block/blk-core.c	2012-04-06 10:56:46.386929357 -0600
@@ -1277,7 +1277,8 @@
  	list_for_each_entry_reverse(rq, &plug->list, queuelist) {
  		int el_ret;

-		(*request_count)++;
+		if (rq->q == q)
+			(*request_count)++;

  		if (rq->q != q || !blk_rq_merge_ok(rq, bio))
  			continue;

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

* Re: [PATCH]block: make auto block plug flush threshold per-disk based
  2012-04-06 17:27 [PATCH]block: make auto block plug flush threshold per-disk based Shaohua Li
@ 2012-04-06 17:39 ` Jens Axboe
  2012-04-09 14:13   ` Jeff Moyer
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2012-04-06 17:39 UTC (permalink / raw)
  To: Shaohua Li; +Cc: linux-kernel

On 2012-04-06 11:27, Shaohua Li wrote:
> We do auto block plug flush to reduce latency, the threshold is 16
> requests. This works well if the task is accessing one or two drives.
> The problem is if the task is accessing a raid 0 device and the raid
> disk number is big, say 8 or 16, 16/8 = 2 or 16/16=1, we will have
> heavy lock contention.
> 
> This patch makes the threshold per-disk based. The latency should be
> still ok accessing one or two drives. The setup with application
> accessing a lot of drives in the meantime uaually is big machine,
> avoiding lock contention is more important, because any contention
> will actually increase latency.

Thanks, applied. It should have been per-queue all along, so this
makes a lot of sense.

-- 
Jens Axboe


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

* Re: [PATCH]block: make auto block plug flush threshold per-disk based
  2012-04-06 17:39 ` Jens Axboe
@ 2012-04-09 14:13   ` Jeff Moyer
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Moyer @ 2012-04-09 14:13 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Shaohua Li, linux-kernel

Jens Axboe <axboe@kernel.dk> writes:

> On 2012-04-06 11:27, Shaohua Li wrote:
>> We do auto block plug flush to reduce latency, the threshold is 16
>> requests. This works well if the task is accessing one or two drives.
>> The problem is if the task is accessing a raid 0 device and the raid
>> disk number is big, say 8 or 16, 16/8 = 2 or 16/16=1, we will have
>> heavy lock contention.
>> 
>> This patch makes the threshold per-disk based. The latency should be
>> still ok accessing one or two drives. The setup with application
>> accessing a lot of drives in the meantime uaually is big machine,
>> avoiding lock contention is more important, because any contention
>> will actually increase latency.
>
> Thanks, applied. It should have been per-queue all along, so this
> makes a lot of sense.

Yeah, I had noticed this before when looking over the code.  Makes
sense.

Acked-by: Jeff Moyer <jmoyer@redhat.com>

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

end of thread, other threads:[~2012-04-09 14:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-06 17:27 [PATCH]block: make auto block plug flush threshold per-disk based Shaohua Li
2012-04-06 17:39 ` Jens Axboe
2012-04-09 14:13   ` Jeff Moyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).