From d5dfd6c9bfb6c20775763c79395f30a41fad70b4 Mon Sep 17 00:00:00 2001 From: Li Nan Date: Wed, 10 Jan 2024 10:00:45 +0800 Subject: [PATCH 1/2] cgroup: Support iocost for cgroup v1 hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8ND38 --------------------------- Since iocost can only be used in cgroup v2, add it to v1 now. Provide config BLK_CGROUP_LEGACY_IOCOST to control this feature. Signed-off-by: Li Nan --- block/Kconfig | 10 ++++++++++ block/blk-iocost.c | 27 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/block/Kconfig b/block/Kconfig index 03b53a50939f..7c7187366450 100644 --- a/block/Kconfig +++ b/block/Kconfig @@ -188,6 +188,16 @@ config BLK_CGROUP_IOCOST distributes IO capacity between different groups based on their share of the overall weight distribution. +config BLK_CGROUP_LEGACY_IOCOST + bool "Enable iocost in cgroup v1" + default n + depends on BLK_CGROUP_IOCOST=y + help + Enabling this option enables the .cost.weight interface for cost + model based proportional IO control when cgroup is version 1. + + If unsure, say N. + config BLK_CGROUP_IOPRIO bool "Cgroup I/O controller for assigning an I/O priority class" depends on BLK_CGROUP diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 089fcb9cfce3..92ad34e95378 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -3490,6 +3490,30 @@ static ssize_t ioc_cost_model_write(struct kernfs_open_file *of, char *input, return ret; } +#ifdef CONFIG_BLK_CGROUP_LEGACY_IOCOST +static struct cftype ioc_legacy_files[] = { + { + .name = "cost.weight", + .flags = CFTYPE_NOT_ON_ROOT, + .seq_show = ioc_weight_show, + .write = ioc_weight_write, + }, + { + .name = "cost.qos", + .flags = CFTYPE_ONLY_ON_ROOT, + .seq_show = ioc_qos_show, + .write = ioc_qos_write, + }, + { + .name = "cost.model", + .flags = CFTYPE_ONLY_ON_ROOT, + .seq_show = ioc_cost_model_show, + .write = ioc_cost_model_write, + }, + {} +}; +#endif + static struct cftype ioc_files[] = { { .name = "weight", @@ -3514,6 +3538,9 @@ static struct cftype ioc_files[] = { static struct blkcg_policy blkcg_policy_iocost = { .dfl_cftypes = ioc_files, +#ifdef CONFIG_BLK_CGROUP_LEGACY_IOCOST + .legacy_cftypes = ioc_legacy_files, +#endif .cpd_alloc_fn = ioc_cpd_alloc, .cpd_free_fn = ioc_cpd_free, .pd_alloc_fn = ioc_pd_alloc, -- Gitee From 5abc6f88174975c21f931db1076b48e1282b6106 Mon Sep 17 00:00:00 2001 From: Li Nan Date: Wed, 10 Jan 2024 10:00:46 +0800 Subject: [PATCH 2/2] openeuler_defconfig: enable iocost in openeuler_defconfig for x86 and arm64 hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8ND38 --------------------------- Set CONFIG_BLK_CGROUP_IOCOST=y, CONFIG_BLK_CGROUP_LEGACY_IOCOST=y, CONFIG_BLK_RQ_ALLOC_TIME=y in openeuler_defconfig for x86 and arm64. Signed-off-by: Li Nan --- arch/arm64/configs/openeuler_defconfig | 4 +++- arch/x86/configs/openeuler_defconfig | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/arm64/configs/openeuler_defconfig b/arch/arm64/configs/openeuler_defconfig index cc174174c745..d95a1909d68a 100644 --- a/arch/arm64/configs/openeuler_defconfig +++ b/arch/arm64/configs/openeuler_defconfig @@ -873,6 +873,7 @@ CONFIG_MODPROBE_PATH="/sbin/modprobe" CONFIG_MODULES_TREE_LOOKUP=y CONFIG_BLOCK=y CONFIG_BLOCK_LEGACY_AUTOLOAD=y +CONFIG_BLK_RQ_ALLOC_TIME=y CONFIG_BLK_CGROUP_RWSTAT=y CONFIG_BLK_CGROUP_PUNT_BIO=y CONFIG_BLK_DEV_BSG_COMMON=y @@ -888,7 +889,8 @@ CONFIG_BLK_WBT=y CONFIG_BLK_WBT_MQ=y # CONFIG_BLK_CGROUP_IOLATENCY is not set # CONFIG_BLK_CGROUP_FC_APPID is not set -# CONFIG_BLK_CGROUP_IOCOST is not set +CONFIG_BLK_CGROUP_IOCOST=y +CONFIG_BLK_CGROUP_LEGACY_IOCOST=y # CONFIG_BLK_CGROUP_IOPRIO is not set CONFIG_BLK_DEBUG_FS=y CONFIG_BLK_DEBUG_FS_ZONED=y diff --git a/arch/x86/configs/openeuler_defconfig b/arch/x86/configs/openeuler_defconfig index d929d6bb706a..8d3d5abc3f5d 100644 --- a/arch/x86/configs/openeuler_defconfig +++ b/arch/x86/configs/openeuler_defconfig @@ -938,6 +938,7 @@ CONFIG_MODPROBE_PATH="/sbin/modprobe" CONFIG_MODULES_TREE_LOOKUP=y CONFIG_BLOCK=y CONFIG_BLOCK_LEGACY_AUTOLOAD=y +CONFIG_BLK_RQ_ALLOC_TIME=y CONFIG_BLK_CGROUP_RWSTAT=y CONFIG_BLK_CGROUP_PUNT_BIO=y CONFIG_BLK_DEV_BSG_COMMON=y @@ -953,7 +954,8 @@ CONFIG_BLK_WBT=y CONFIG_BLK_WBT_MQ=y # CONFIG_BLK_CGROUP_IOLATENCY is not set # CONFIG_BLK_CGROUP_FC_APPID is not set -# CONFIG_BLK_CGROUP_IOCOST is not set +CONFIG_BLK_CGROUP_IOCOST=y +CONFIG_BLK_CGROUP_LEGACY_IOCOST=y # CONFIG_BLK_CGROUP_IOPRIO is not set CONFIG_BLK_DEBUG_FS=y CONFIG_BLK_DEBUG_FS_ZONED=y -- Gitee