• Ming Lei's avatar
    blk-mq: don't schedule block kworker on isolated CPUs · a46c2702
    Ming Lei authored
    Kernel parameter of `isolcpus=` or 'nohz_full=' are used to isolate CPUs
    for specific task, and it isn't expected to let block IO disturb these CPUs.
    blk-mq kworker shouldn't be scheduled on isolated CPUs. Also if isolated
    CPUs is run for blk-mq kworker, long block IO latency can be caused.
    
    Kernel workqueue only respects CPU isolation for WQ_UNBOUND, for bound
    WQ, the responsibility is on user because CPU is specified as WQ API
    parameter, such as mod_delayed_work_on(cpu), queue_delayed_work_on(cpu)
    and queue_work_on(cpu).
    
    So not run blk-mq kworker on isolated CPUs by removing isolated CPUs
    from hctx->cpumask. Meantime use queue map to check if all CPUs in this
    hw queue are offline instead of hctx->cpumask, this way can avoid any
    cost in fast IO code path, and is safe since hctx->cpumask are only
    used in the two cases.
    
    Cc: Tim Chen <tim.c.chen@linux.intel.com>
    Cc: Juri Lelli <juri.lelli@redhat.com>
    Cc: Andrew Theurer <atheurer@redhat.com>
    Cc: Joe Mario <jmario@redhat.com>
    Cc: Sebastian Jug <sejug@redhat.com>
    Cc: Frederic Weisbecker <frederic@kernel.org>
    Cc: Bart Van Assche <bvanassche@acm.org>
    Cc: Tejun Heo <tj@kernel.org>
    Tesed-by: default avatarJoe Mario <jmario@redhat.com>
    Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
    Reviewed-by: default avatarEwan D. Milne <emilne@redhat.com>
    Link: https://lore.kernel.org/r/20240322021244.1056223-1-ming.lei@redhat.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
    a46c2702
blk-mq.c 124 KB