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 <tylernij@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
Tyler Nijmeh 2020-06-15 16:05:34 -07:00 committed by Richard Raya
parent 6f0859c5bf
commit 06c6147719

View File

@ -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)) {