Commit 508d4608 authored by Yu Kuai's avatar Yu Kuai
Browse files

blk-io-hierarchy: support new bio based stage iocost

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: default avatarYu Kuai <yukuai3@huawei.com>
parent 449f81e0
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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
+6 −0
Original line number Diff line number Diff line
@@ -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:
+3 −0
Original line number Diff line number Diff line
@@ -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,