hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/release-management/issues/IB4E8P CVE: NA
--------------------------------
Like blk-throttle, following new debugfs entries will be created for rq-based disk if kyber is enabled:
/sys/kernel/debug/block/sda/blk_io_hierarchy/ |-- kyber | |-- io_dump | |-- stats | `-- threshold
User can use them to analyze how IO behaves in kyber.
Signed-off-by: Yu Kuai yukuai3@huawei.com --- block/blk-io-hierarchy/Kconfig | 11 +++++++++++ block/kyber-iosched.c | 7 +++++++ include/linux/blk_types.h | 3 +++ 3 files changed, 21 insertions(+)
diff --git a/block/blk-io-hierarchy/Kconfig b/block/blk-io-hierarchy/Kconfig index e978fa5c162c..3cc51933def3 100644 --- a/block/blk-io-hierarchy/Kconfig +++ b/block/blk-io-hierarchy/Kconfig @@ -101,4 +101,15 @@ config HIERARCHY_BFQ
If unsure, say N.
+config HIERARCHY_KYBER + bool "Enable hierarchy stats layer kyber" + default n + depends on MQ_IOSCHED_KYBER + help + Enabling this lets blk hierarchy stats to record additional information + for kyber. Such information can be helpful to debug performance + and problems like io hang. + + If unsure, say N. + endif diff --git a/block/kyber-iosched.c b/block/kyber-iosched.c index 4155594aefc6..299d6edce8ea 100644 --- a/block/kyber-iosched.c +++ b/block/kyber-iosched.c @@ -18,6 +18,7 @@ #include "blk-mq.h" #include "blk-mq-debugfs.h" #include "blk-mq-sched.h" +#include "blk-io-hierarchy/stats.h"
#define CREATE_TRACE_POINTS #include <trace/events/kyber.h> @@ -424,6 +425,7 @@ static int kyber_init_sched(struct request_queue *q, struct elevator_type *e) eq->elevator_data = kqd; q->elevator = eq;
+ blk_mq_register_hierarchy(q, STAGE_KYBER); return 0; }
@@ -432,6 +434,7 @@ static void kyber_exit_sched(struct elevator_queue *e) struct kyber_queue_data *kqd = e->elevator_data; int i;
+ blk_mq_unregister_hierarchy(kqd->q, STAGE_KYBER); timer_shutdown_sync(&kqd->timer); blk_stat_disable_accounting(kqd->q);
@@ -594,6 +597,7 @@ static void kyber_insert_requests(struct blk_mq_hw_ctx *hctx, struct kyber_hctx_data *khd = hctx->sched_data; struct request *rq, *next;
+ rq_list_hierarchy_start_io_acct(rq_list, STAGE_KYBER); list_for_each_entry_safe(rq, next, rq_list, queuelist) { unsigned int sched_domain = kyber_sched_domain(rq->cmd_flags); struct kyber_ctx_queue *kcq = &khd->kcqs[rq->mq_ctx->index_hw[hctx->type]]; @@ -843,6 +847,9 @@ static struct request *kyber_dispatch_request(struct blk_mq_hw_ctx *hctx) rq = NULL; out: spin_unlock(&khd->lock); + + if (rq) + rq_hierarchy_end_io_acct(rq, STAGE_KYBER); return rq; }
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 98df563ef755..95fdc8fc2dc5 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -494,6 +494,9 @@ enum stage_group { #endif #if IS_ENABLED(CONFIG_IOSCHED_BFQ) STAGE_BFQ, +#endif +#if IS_ENABLED(CONFIG_MQ_IOSCHED_KYBER) + STAGE_KYBER, #endif NR_RQ_STAGE_GROUPS, STAGE_BIO = NR_RQ_STAGE_GROUPS,