summaryrefslogtreecommitdiffstats
path: root/block/blk-softirq.c
diff options
context:
space:
mode:
authorMing Lei <ming.lei@redhat.com>2018-09-28 04:42:20 -0400
committerJens Axboe <axboe@kernel.dk>2018-10-08 12:50:43 -0400
commit36e765392e48e0322222347c4d21078c0b94758c (patch)
tree2400722b5eafca827323b315ac00d116dcbd998e /block/blk-softirq.c
parent3a646fd77684dd5fbe20748bb04e12077bbecddc (diff)
blk-mq: complete req in softirq context in case of single queue
Lot of controllers may have only one irq vector for completing IO request. And usually affinity of the only irq vector is all possible CPUs, however, on most of ARCH, there may be only one specific CPU for handling this interrupt. So if all IOs are completed in hardirq context, it is inevitable to degrade IO performance because of increased irq latency. This patch tries to address this issue by allowing to complete request in softirq context, like the legacy IO path. IOPS is observed as ~13%+ in the following randread test on raid0 over virtio-scsi. mdadm --create --verbose /dev/md0 --level=0 --chunk=1024 --raid-devices=8 /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf /dev/sdg /dev/sdh /dev/sdi fio --time_based --name=benchmark --runtime=30 --filename=/dev/md0 --nrfiles=1 --ioengine=libaio --iodepth=32 --direct=1 --invalidate=1 --verify=0 --verify_fatal=0 --numjobs=32 --rw=randread --blocksize=4k Cc: Dongli Zhang <dongli.zhang@oracle.com> Cc: Zach Marano <zmarano@google.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Bart Van Assche <bvanassche@acm.org> Cc: Jianchao Wang <jianchao.w.wang@oracle.com> Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-softirq.c')
-rw-r--r--block/blk-softirq.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/block/blk-softirq.c b/block/blk-softirq.c
index 15c1f5e12eb8..e47a2f751884 100644
--- a/block/blk-softirq.c
+++ b/block/blk-softirq.c
@@ -97,8 +97,8 @@ static int blk_softirq_cpu_dead(unsigned int cpu)
97 97
98void __blk_complete_request(struct request *req) 98void __blk_complete_request(struct request *req)
99{ 99{
100 int ccpu, cpu;
101 struct request_queue *q = req->q; 100 struct request_queue *q = req->q;
101 int cpu, ccpu = q->mq_ops ? req->mq_ctx->cpu : req->cpu;
102 unsigned long flags; 102 unsigned long flags;
103 bool shared = false; 103 bool shared = false;
104 104
@@ -110,8 +110,7 @@ void __blk_complete_request(struct request *req)
110 /* 110 /*
111 * Select completion CPU 111 * Select completion CPU
112 */ 112 */
113 if (req->cpu != -1) { 113 if (test_bit(QUEUE_FLAG_SAME_COMP, &q->queue_flags) && ccpu != -1) {
114 ccpu = req->cpu;
115 if (!test_bit(QUEUE_FLAG_SAME_FORCE, &q->queue_flags)) 114 if (!test_bit(QUEUE_FLAG_SAME_FORCE, &q->queue_flags))
116 shared = cpus_share_cache(cpu, ccpu); 115 shared = cpus_share_cache(cpu, ccpu);
117 } else 116 } else