• Chong Yuan's avatar
    blk-mq: reduce unnecessary software queue looping · 889fa31f
    Chong Yuan authored
    In flush_busy_ctxs() and blk_mq_hctx_has_pending(), regardless of how many
    ctxs assigned to one hctx, they will all loop hctx->ctx_map.map_size
    times. Here hctx->ctx_map.map_size is a const ALIGN(nr_cpu_ids, 8) / 8.
    Especially, flush_busy_ctxs() is in hot code path. And it's unnecessary.
    Change ->map_size to contain the actually mapped software queues, so we
    only loop for as many iterations as we have to.
    
    And remove cpumask setting and nr_ctx count in blk_mq_init_cpu_queues()
    since they are all re-done in blk_mq_map_swqueue().
    blk_mq_map_swqueue().
    Signed-off-by: default avatarChong Yuan <chong.yuan@memblaze.com>
    Reviewed-by: default avatarWenbo Wang <wenbo.wang@memblaze.com>
    
    Updated by me for formatting and commenting.
    Signed-off-by: default avatarJens Axboe <axboe@fb.com>
    889fa31f
blk-mq.c 52 KB