From: Zhaoyang Huang <zhaoyang.huang@xxxxxxxxxx> There is always an error between blk-throttle's configuration and the real value which should be introduced by over-sized bio as there is no control on ra->size during readahead. This series patches would like to introduce the helper function to provide the bytes budgt and apply it on readahead. Please find below for the fio test result on v6.6 which presents 2%-10% improvement for BW and lat. Besides, we can also observed stable BW instantaneous and lower stdev value during the test. blkio.throttle.read_bps_device = 1MB/s before: read: IOPS=223, BW=894KiB/s (915kB/s)(175MiB/200919msec) after : read: IOPS=239, BW=960KiB/s (983kB/s)(153MiB/163105msec) before: clat (usec): min=4, max=16795k, avg=4468.74, stdev=265746.14 after : clat (usec): min=11, max=209193, avg=4105.22, stdev=27188.04 before: lat (usec): min=6, max=16795k, avg=4470.57, stdev=265746.14 after : lat (usec): min=16, max=209197, avg=4120.03, stdev=27188.04 blkio.throttle.read_bps_device = 10MB/s before: read: IOPS=2380, BW=9524KiB/s (9752kB/s)(1007MiB/108311msec) after : read: IOPS=2438, BW=9754KiB/s (9989kB/s)(1680MiB/176405msec) before: clat (usec): min=4, max=2494.6k, avg=412.72, stdev=25783.51 after : clat (usec): min=4, max=201817, avg=399.58, stdev=8268.85 before: lat (usec): min=6, max=2494.6k, avg=414.48, stdev=25783.51 after : lat (usec): min=6, max=201819, avg=402.10, stdev=8268.85 blkio.throttle.read_bps_device = 20MB/s fio ... -numjobs=8 ... before : IOPS=37.9k, BW=148MiB/s (155MB/s)(11.6GiB/80333msec) after : IOPS=39.0k, BW=153MiB/s (160MB/s)(15.6GiB/104914msec) before : clat (usec): min=4, max=1056.6k, avg=197.23, stdev=10080.69 after : clat (usec): min=4, max=193481, avg=188.83, stdev=4651.29 before : lat (usec): min=5, max=1056.6k, avg=200.48, stdev=10080.76 after : lat (usec): min=5, max=193483, avg=192.68, stdev=4651.87 blkio.throttle.read_bps_device = 30MB/s fio ... -numjobs=8 ... before : IOPS=57.2k, BW=224MiB/s (234MB/s)(15.6GiB/71561msec) after : IOPS=58.5k, BW=229MiB/s (240MB/s)(15.6GiB/69996msec) before : clat (usec): min=4, max=1105.5k, avg=126.20, stdev=6419.22 after : clat (usec): min=4, max=183956, avg=120.60, stdev=2957.28 before : lat (usec): min=5, max=1105.5k, avg=129.45, stdev=6419.29 after : lat (usec): min=5, max=183958, avg=124.40, stdev=2958.18 Zhaoyang Huang (2): block: introduce helper function to calculate bps budgt mm: introduce budgt control in readahead block/blk-throttle.c | 44 ++++++++++++++++++++++++++++++++++++++ include/linux/blk-cgroup.h | 10 +++++++++ mm/readahead.c | 33 ++++++++++++++++++++-------- 3 files changed, 78 insertions(+), 9 deletions(-) -- 2.25.1