Skip to contentSkip to conversation

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

PATCH Applied Shaohua Li 3 participants 3 messages Apr 6, 2012 – Apr 9, 2012 Block layer

lore
Share & tools
lore

Shaohua Li

author
#0 lore raw

PATCH 1/1 block: make auto block plug flush threshold per-disk based

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.

---
 block/blk-core.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
block/blk-core.c +2 -1
Index: linux/block/blk-core.c
===================================================================
@@ -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;
maintainer Applied
#1 lore raw
Quoted 11 lines · Shaohua Li

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.

Signature · 1 line
Jens Axboe
Acked-by
#2 lore raw
Quoted 7 lines · Jens Axboe
Quoted 6 lines · Shaohua Li

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.

Quoted 8 lines
Quoted 5 lines

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.