hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/release-management/issues/IB4E8P CVE: NA
--------------------------------
Like blk-throttle, if iocost is enabled, following new debugfs entries will be created as well.
/sys/kernel/debug/block/sda/blk_io_hierarchy/ |-- iocost | |-- io_dump | |-- stats | `-- threshold
User can use them to analyze how IO behaves in iocost.
Signed-off-by: Yu Kuai yukuai3@huawei.com --- block/blk-io-hierarchy/Kconfig | 11 +++++++++++ block/blk-iocost.c | 6 ++++++ include/linux/blk_types.h | 3 +++ 3 files changed, 20 insertions(+)
diff --git a/block/blk-io-hierarchy/Kconfig b/block/blk-io-hierarchy/Kconfig index ad1b7abc7610..43ada3d9f0a5 100644 --- a/block/blk-io-hierarchy/Kconfig +++ b/block/blk-io-hierarchy/Kconfig @@ -48,4 +48,15 @@ config HIERARCHY_WBT
If unsure, say N.
+config HIERARCHY_IOCOST + bool "Enable hierarchy stats layer iocost" + default n + depends on BLK_CGROUP_IOCOST + help + Enabling this lets blk hierarchy stats to record additional information + for blk-iocost. Such information can be helpful to debug performance + and problems like io hang. + + If unsure, say N. + endif diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 67c8941b2c1d..5c1366a2182b 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -184,6 +184,7 @@ #include "blk-stat.h" #include "blk-wbt.h" #include "blk-cgroup.h" +#include "blk-io-hierarchy/stats.h"
#ifdef CONFIG_TRACEPOINTS
@@ -2722,12 +2723,14 @@ static void ioc_rqos_throttle(struct rq_qos *rqos, struct bio *bio)
iocg_unlock(iocg, ioc_locked, &flags);
+ bio_hierarchy_start_io_acct(bio, STAGE_IOCOST); while (true) { set_current_state(TASK_UNINTERRUPTIBLE); if (wait.committed) break; io_schedule(); } + bio_hierarchy_end_io_acct(bio, STAGE_IOCOST);
/* waker already committed us, proceed */ finish_wait(&iocg->waitq, &wait.wait); @@ -2853,6 +2856,7 @@ static void ioc_rqos_exit(struct rq_qos *rqos) { struct ioc *ioc = rqos_to_ioc(rqos);
+ blk_mq_unregister_hierarchy(rqos->disk->queue, STAGE_IOCOST); blkcg_deactivate_policy(rqos->disk, &blkcg_policy_iocost);
spin_lock_irq(&ioc->lock); @@ -2928,6 +2932,8 @@ static int blk_iocost_init(struct gendisk *disk) ret = blkcg_activate_policy(disk, &blkcg_policy_iocost); if (ret) goto err_del_qos; + + blk_mq_register_hierarchy(disk->queue, STAGE_IOCOST); return 0;
err_del_qos: diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index fe683cfbc157..eb794e8820ec 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -482,6 +482,9 @@ enum stage_group { #endif #ifdef CONFIG_BLK_WBT STAGE_WBT, +#endif +#ifdef CONFIG_BLK_CGROUP_IOCOST + STAGE_IOCOST, #endif STAGE_RESERVE, NR_BIO_STAGE_GROUPS,