From 06c61477197807a052de1fa1777464073d38ef7c Mon Sep 17 00:00:00 2001 From: Tyler Nijmeh Date: Mon, 15 Jun 2020 16:05:34 -0700 Subject: [PATCH] blk-mq: Do not wake idle CPUs to queue same-origin requests Same-origin requests are great for cache locality, but in the case where the origin CPU is already idle (i.e. the task his migrated), waking it to process a block request is inefficient for power management. Since the currently executing CPU is not considered idle, it would be more power efficient to miss the cache hit and avoid waking an idle CPU. Change-Id: Id8b581e4149c1d6afc73e492392d0edaf32e0266 Signed-off-by: Tyler Nijmeh Signed-off-by: Richard Raya --- block/blk-mq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 1b75a2c79f61..22ef62ae8c97 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -556,7 +556,8 @@ static void __blk_mq_complete_request(struct request *rq) } cpu = get_cpu(); - if (!test_bit(QUEUE_FLAG_SAME_FORCE, &rq->q->queue_flags)) + if (!test_bit(QUEUE_FLAG_SAME_FORCE, &rq->q->queue_flags) || + idle_cpu(ctx->cpu)) shared = cpus_share_cache(cpu, ctx->cpu); if (cpu != ctx->cpu && !shared && cpu_online(ctx->cpu)) {