From 008e2ff5401e0e72e858efd19eea69737a43fa44 Mon Sep 17 00:00:00 2001 From: Tyler Nijmeh Date: Fri, 14 Jun 2019 16:01:55 -0700 Subject: [PATCH] block: Do not wake the request CPU if idle Refrain from waking up an idle CPU if possible since the exit latency of taking req->cpu out of an idle cstate will likely exceed the rq->deadline constraint compared to executing the request locally instead. Signed-off-by: Tyler Nijmeh Signed-off-by: CloudedQuartz Signed-off-by: Mayur --- block/blk-softirq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/block/blk-softirq.c b/block/blk-softirq.c index 01e2b353a2b9..c77a77c5e1db 100644 --- a/block/blk-softirq.c +++ b/block/blk-softirq.c @@ -109,8 +109,13 @@ void __blk_complete_request(struct request *req) /* * Select completion CPU + * + * Refrain from waking up an idle CPU if possible since the exit + * latency of taking req->cpu out of an idle cstate will likely + * exceed the rq->deadline constraint compared to executing the + * request locally instead. */ - if (req->cpu != -1) { + if (req->cpu != -1 && !idle_cpu(req->cpu)) { ccpu = req->cpu; if (!test_bit(QUEUE_FLAG_SAME_FORCE, &q->queue_flags)) shared = cpus_share_cache(cpu, ccpu);