• Jan Kara's avatar
    blk-mq: Improve performance of non-mq IO schedulers with multiple HW queues · b6e68ee8
    Jan Kara authored
    Currently when non-mq aware IO scheduler (BFQ, mq-deadline) is used for
    a queue with multiple HW queues, the performance it rather bad. The
    problem is that these IO schedulers use queue-wide locking and their
    dispatch function does not respect the hctx it is passed in and returns
    any request it finds appropriate. Thus locality of request access is
    broken and dispatch from multiple CPUs just contends on IO scheduler
    locks. For these IO schedulers there's little point in dispatching from
    multiple CPUs. Instead dispatch always only from a single CPU to limit
    contention.
    
    Below is a comparison of dbench runs on XFS filesystem where the storage
    is a raid card with 64 HW queues and to it attached a single rotating
    disk. BFQ is used as IO scheduler:
    
          clients           MQ                     SQ             MQ-Patched
    Amean 1      39.12 (0.00%)       43.29 * -10.67%*       36.09 *   7.74%*
    Amean 2     128.58 (0.00%)      101.30 *  21.22%*       96.14 *  25.23%*
    Amean 4     577.42 (0.00%)      494.47 *  14.37%*      508.49 *  11.94%*
    Amean 8     610.95 (0.00%)      363.86 *  40.44%*      362.12 *  40.73%*
    Amean 16    391.78 (0.00%)      261.49 *  33.25%*      282.94 *  27.78%*
    Amean 32    324.64 (0.00%)      267.71 *  17.54%*      233.00 *  28.23%*
    Amean 64    295.04 (0.00%)      253.02 *  14.24%*      242.37 *  17.85%*
    Amean 512 10281.61 (0.00%)    10211.16 *   0.69%*    10447.53 *  -1.61%*
    
    Numbers are times so lower is better. MQ is stock 5.10-rc6 kernel. SQ is
    the same kernel with megaraid_sas.host_tagset_enable=0 so that the card
    advertises just a single HW queue. MQ-Patched is a kernel with this
    patch applied.
    
    You can see multiple hardware queues heavily hurt performance in
    combination with BFQ. The patch restores the performance.
    Signed-off-by: default avatarJan Kara <jack@suse.cz>
    Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    b6e68ee8
blk-mq.c 98.5 KB