diff options
author | Ming Lei <ming.lei@redhat.com> | 2018-07-02 05:35:59 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-07-09 11:07:53 -0400 |
commit | b04f50ab8a74129b3041a2836c33c916be3c6667 (patch) | |
tree | ccf5718c53c6afabf85f3c2597994938147f7ac9 /block/blk-mq-sched.c | |
parent | 3f0cedc7e9a0b32e79c79d2aac0c96d2b870ae55 (diff) |
blk-mq: only attempt to merge bio if there is rq in sw queue
Only attempt to merge bio iff the ctx->rq_list isn't empty, because:
1) for high-performance SSD, most of times dispatch may succeed, then
there may be nothing left in ctx->rq_list, so don't try to merge over
sw queue if it is empty, then we can save one acquiring of ctx->lock
2) we can't expect good merge performance on per-cpu sw queue, and missing
one merge on sw queue won't be a big deal since tasks can be scheduled from
one CPU to another.
Cc: Laurence Oberman <loberman@redhat.com>
Cc: Omar Sandoval <osandov@fb.com>
Cc: Bart Van Assche <bart.vanassche@wdc.com>
Tested-by: Kashyap Desai <kashyap.desai@broadcom.com>
Reported-by: Kashyap Desai <kashyap.desai@broadcom.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-mq-sched.c')
-rw-r--r-- | block/blk-mq-sched.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c index 4e027f6108ae..f3b4b5ceb4d1 100644 --- a/block/blk-mq-sched.c +++ b/block/blk-mq-sched.c | |||
@@ -326,7 +326,8 @@ bool __blk_mq_sched_bio_merge(struct request_queue *q, struct bio *bio) | |||
326 | return e->type->ops.mq.bio_merge(hctx, bio); | 326 | return e->type->ops.mq.bio_merge(hctx, bio); |
327 | } | 327 | } |
328 | 328 | ||
329 | if (hctx->flags & BLK_MQ_F_SHOULD_MERGE) { | 329 | if ((hctx->flags & BLK_MQ_F_SHOULD_MERGE) && |
330 | !list_empty_careful(&ctx->rq_list)) { | ||
330 | /* default per sw-queue merge */ | 331 | /* default per sw-queue merge */ |
331 | spin_lock(&ctx->lock); | 332 | spin_lock(&ctx->lock); |
332 | ret = blk_mq_attempt_merge(q, ctx, bio); | 333 | ret = blk_mq_attempt_merge(q, ctx, bio); |