Commit a6b3f7614ca690e49e934c291f707b0c19312194
Committed by
Jens Axboe
1 parent
a5faeaf910
Exists in
master
and in
20 other branches
block: Reserve only one queue tag for sync IO if only 3 tags are available
In case a device has three tags available we still reserve two of them for sync IO. That leaves only a single tag for async IO such as writeback from flusher thread which results in poor performance. Allow async IO to consume two tags in case queue has three tag availabe to get a decent async write performance. This patch improves streaming write performance on a machine with such disk from ~21 MB/s to ~52 MB/s. Also postmark throughput in presence of streaming writer improves from 8 to 12 transactions per second so sync IO doesn't seem to be harmed in presence of heavy async writer. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Showing 1 changed file with 9 additions and 2 deletions Side-by-side Diff
block/blk-tag.c
... | ... | @@ -348,9 +348,16 @@ |
348 | 348 | */ |
349 | 349 | max_depth = bqt->max_depth; |
350 | 350 | if (!rq_is_sync(rq) && max_depth > 1) { |
351 | - max_depth -= 2; | |
352 | - if (!max_depth) | |
351 | + switch (max_depth) { | |
352 | + case 2: | |
353 | 353 | max_depth = 1; |
354 | + break; | |
355 | + case 3: | |
356 | + max_depth = 2; | |
357 | + break; | |
358 | + default: | |
359 | + max_depth -= 2; | |
360 | + } | |
354 | 361 | if (q->in_flight[BLK_RW_ASYNC] > max_depth) |
355 | 362 | return 1; |
356 | 363 | } |