Hi Jens This patchset is working on our v4.18 kernel to provide the capacity for upgrade blk-rq-qos policies on the fly w/o needing to restart machine and applications. In previous discussion, the modularization has been rid of. Please refer to the link: https://www.spinics.net/lists/linux-block/msg79958.html Right now, patchset is to make blk-rq-qos policies pluggable through a new sysfs interface, /sys/block/xxx/queue/qos. Then we can open/close policy per device and needn't to iterate the rqos list and allocate memory for them if we don't use. The blktest has passed along with a new test case which switches rqos policies with running fio in cgroups. Refer to following link, https://patchwork.kernel.org/project/linux-block/patch/20220224085340.53854-1-jianchao.wan9@xxxxxxxxx/ When do the test above, I find the queue freezing mechanism has not been able to protect the whole blk_mq_submit_bio(). I guess it should be for saving some cpu cyles. But queue freezing is the basis for patchset. So I add it back as the 1st patch which maybe unacceptable. The 2nd ~ 8th provide the new API and adapt the code of blk-wbt, blk-iolatency, blk-iocost and blk-ioprio to use the new API. And finally, the /sys/block/xxx/queue/qos is exposed. The following patches on blk-wbt may break its original assumpation. The 9th patch is to expose 'wbt_lat_nsec' when 'wbt' police is opened. And some code cleanup is also there as some interfaces needn't to be exposed. The 10th patch gets rid of the following actions, enable wbt by default, disable wbt when bfq is enabled. The user should be responsible for selecting different policies. The 11th patch gets rid of the rqos debugfs interfaces registeration when queue is initialized as there is not any default policies any more. The 12th patch rename blk-rq-qos's queue_depth_changed callback to setting_changed, then we can involve the cache state changing. The 13th patch involve the cache state changing into setting_changed callback, then the last exposed interface of wbt is get rid of. The 14th patch cleanup the blk-wbt.h as there is nothing need to be exposed. The 15th patch moves the rqos debugfs registeration interfaces to blk-rq-qos.c The 16th patch adds a new CONFIG_BLK_RQ_QOS to control the whole blk-rq-qos code. Changes since v4: - add 1st patch to protect the whole blk_mq_submit_bio path. - add sysfs_lock around the rq_qos_queue_depth_changed() - add qos_lock to protect the rqos list - add patches to clean up the blk-wbt - add new config to control blk-rq-qos's code Changes since v3: - Fix some code sytle issues - Rename policies to blk-wbt, blk-iolat, blk-iocost, blk-ioprio Changes since v2: Refactor the patches, - patch01 only provide new interfaces and not export the sysfs interface. - patch02 adapt the wbt to new interface, reserve the previous action when write to wbt_lat - export sysfs interface in last patch when all of the blk-rqos policies are preprared well. Changes since v1: - Just make iocost and iolatency pluggable, then we needn't to export those interfaces - Remove the iostat rqos policy - Rename module of blk-ioprio to io-prio to avoid rename ioprio.c file Wang Jianchao(16) blk: make the whole blk_mq_submit_bio under blk/rq-qos: prepare to make blk-rq-qos pluggable blk-wbt: make wbt pluggable blk-iolatency: make iolatency pluggable blk-iocost: make iocost pluggable blk-ioprio: make ioprio pluggable blk/rq-qos: get rid of unused interfaces of rqos blk/rq-qos: export the sysfs for switching qos blk-wbt: show wbt_lat_us sysfs interface only when wbt blk-wbt: get rid of wbt_enable/disable_default() blk/rq-qos: get rid of debugfs register in blk/rq-qos: change queue_depth_changed to blk-wbt: move cache setting to blk-wbt: cleanup the blk-wbt.h blk/rq-qos: move the rqos debugfs code to blk-rq-qos.c blk/rq-qos: add config to control the whole blk-rq-qos 15 files changed, 488 insertions(+), 172 deletions(-) block/Kconfig | 7 ++ block/Makefile | 3 +- block/bfq-iosched.c | 2 - block/blk-cgroup.c | 11 -- block/blk-core.c | 1 + block/blk-iocost.c | 83 +++++++------ block/blk-iolatency.c | 44 ++++--- block/blk-ioprio.c | 53 +++++---- block/blk-ioprio.h | 19 --- block/blk-mq-debugfs.c | 67 +---------- block/blk-mq-debugfs.h | 17 +-- block/blk-mq-sched.c | 1 - block/blk-mq.c | 22 ++-- block/blk-rq-qos.c | 285 +++++++++++++++++++++++++++++++++++++++++++- block/blk-rq-qos.h | 124 +++++++------------ block/blk-settings.c | 6 +- block/blk-sysfs.c | 82 ++----------- block/blk-wbt.c | 288 ++++++++++++++++++++++++++++----------------- block/blk-wbt.h | 134 --------------------- block/blk.h | 12 +- block/elevator.c | 3 - include/linux/blkdev.h | 7 +- include/trace/events/wbt.h | 3 +- 23 files changed, 668 insertions(+), 606 deletions(-)