• Bart Van Assche's avatar
    block/mq-deadline: Prioritize high-priority requests · fb926032
    Bart Van Assche authored
    
    
    While one or more requests with a certain I/O priority are pending, do not
    dispatch lower priority requests. Dispatch lower priority requests anyway
    after the "aging" time has expired.
    
    This patch has been tested as follows:
    
    modprobe scsi_debug ndelay=1000000 max_queue=16 &&
    sd='' &&
    while [ -z "$sd" ]; do
      sd=/dev/$(basename /sys/bus/pseudo/drivers/scsi_debug/adapter*/host*/target*/*/block/*)
    done &&
    echo $((100*1000)) > /sys/block/$sd/queue/iosched/aging_expire &&
    cd /sys/fs/cgroup/blkio/ &&
    echo $$ >cgroup.procs &&
    echo restrict-to-be >blkio.prio.class &&
    mkdir -p hipri &&
    cd hipri &&
    echo none-to-rt >blkio.prio.class &&
    { max-iops -a1 -d32 -j1 -e mq-deadline $sd >& ~/low-pri.txt & } &&
    echo $$ >cgroup.procs &&
    max-iops -a1 -d32 -j1 -e mq-deadline $sd >& ~/hi-pri.txt
    
    Result:
    * 11000 IOPS for the high-priority job
    *    40 IOPS for the low-priority job
    
    If the aging expiry time is changed from 100s into 0, the IOPS results change
    into 6712 and 6796 IOPS.
    
    The max-iops script is a script that runs fio with the following arguments:
    --bs=4K --gtod_reduce=1 --ioengine=libaio --ioscheduler=${arg_e} --runtime=60
    --norandommap --rw=read --thread --buffered=0 --numjobs=${arg_j}
    --iodepth=${arg_d} --iodepth_batch_submit=${arg_a}
    --iodepth_batch_complete=$((arg_d / 2)) --name=${positional_argument_1}
    --filename=${positional_argument_1}
    Reviewed-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
    Cc: Hannes Reinecke <hare@suse.de>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: Ming Lei <ming.lei@redhat.com>
    Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
    Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
    Link: https://lore.kernel.org/r/20210618004456.7280-17-bvanassche@acm.org
    
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    fb926032
mq-deadline-main.c 31.9 KB