Skip to content

Commit

Permalink
block: make auto block plug flush threshold per-disk based
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Shaohua Li authored and Jens Axboe committed Apr 6, 2012
1 parent 407ac95 commit 1b2e19f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,8 @@ static bool attempt_plug_merge(struct request_queue *q, struct bio *bio,
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;
Expand Down

0 comments on commit 1b2e19f

Please sign in to comment.