From: Joseph Qi joseph.qi@linux.alibaba.com
maillist inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8QUNW
Reference: https://github.com/alibaba/cloud-kernel/commit/dc159a61c043489e5527aa0c52e7b...
----------------------------------------------
Instead using static kconfig CONFIG_PSI_CGROUP_V1, we introduce a boot parameter psi_v1 to enable psi cgroup v1 support. Default it is disabled, which means when passing psi=1 boot parameter, we only support cgroup v2. This is to keep consistent with other cgroup v1 features such as cgroup writeback v1 (cgwb_v1).
Signed-off-by: Joseph Qi joseph.qi@linux.alibaba.com Acked-by: Xunlei Pang xlpang@linux.alibaba.com Conflicts: kernel/sched/cpuacct.c kernel/sched/psi.c include/linux/psi.h Merge OLK-5.10 fix patch d767c63390e0c1ecf45f1a06d55eb23f613225ab Signed-off-by: Lu Jialin lujialin4@huawei.com --- Documentation/admin-guide/kernel-parameters.txt | 4 ++++ include/linux/psi.h | 1 + init/Kconfig | 10 ---------- kernel/sched/cpuacct.c | 16 ++++++++++++++++ kernel/sched/psi.c | 14 +++++++------- 5 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 41644336e358..3f68499b4ac4 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -4652,6 +4652,10 @@ tracking. Format: <bool>
+ psi_v1= [KNL] Enable or disable pressure stall information + tracking on cgroup v1. + Format: <bool> + psmouse.proto= [HW,MOUSE] Highest PS2 mouse protocol extension to probe for; one of (bare|imps|exps|lifebook|any). psmouse.rate= [HW,MOUSE] Set desired mouse report rate, in reports diff --git a/include/linux/psi.h b/include/linux/psi.h index e0745873e3f2..44cb1358737b 100644 --- a/include/linux/psi.h +++ b/include/linux/psi.h @@ -15,6 +15,7 @@ struct css_set; #ifdef CONFIG_PSI
extern struct static_key_false psi_disabled; +extern struct static_key_false psi_v1_disabled; extern struct psi_group psi_system;
void psi_init(void); diff --git a/init/Kconfig b/init/Kconfig index 3a66ebe72504..2ee1384c4f81 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -667,16 +667,6 @@ config PSI_DEFAULT_DISABLED
Say N if unsure.
-config PSI_CGROUP_V1 - bool "Support PSI under cgroup v1" - default Y - depends on PSI - help - If set, pressure stall information tracking will be used - for cgroup v1 other than v2. - - Say N if unsure. - endmenu # "CPU/Task time and stats accounting"
config CPU_ISOLATION diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c index 91039b9260a4..4e71caf232d3 100644 --- a/kernel/sched/cpuacct.c +++ b/kernel/sched/cpuacct.c @@ -363,10 +363,26 @@ struct cgroup_subsys cpuacct_cgrp_subsys = { };
#ifdef CONFIG_PSI +static bool psi_v1_enable; extern struct cftype cgroup_v1_psi_files[];
+static int __init setup_psi_v1(char *str) +{ + int ret; + + ret = kstrtobool(str, &psi_v1_enable); + if (!psi_v1_enable) + static_branch_enable(&psi_v1_disabled); + + return ret == 0; +} +__setup("psi_v1=", setup_psi_v1); + static int __init cgroup_v1_psi_init(void) { + if (!psi_v1_enable) + return 0; + cgroup_add_legacy_cftypes(&cpuacct_cgrp_subsys, cgroup_v1_psi_files); return 0; } diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index 70c7765766fc..6fe674bee440 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -140,6 +140,7 @@ static int psi_bug __read_mostly;
DEFINE_STATIC_KEY_FALSE(psi_disabled); +DEFINE_STATIC_KEY_FALSE(psi_v1_disabled); static DEFINE_STATIC_KEY_TRUE(psi_cgroups_enabled);
#ifdef CONFIG_PSI_DEFAULT_DISABLED @@ -885,14 +886,13 @@ static inline struct psi_group *task_psi_group(struct task_struct *task) { #ifdef CONFIG_CGROUPS if (static_branch_likely(&psi_cgroups_enabled)) { -#ifdef CONFIG_PSI_CGROUP_V1 - if (!cgroup_subsys_on_dfl(cpuacct_cgrp_subsys)) - return cgroup_psi(task_cgroup(task, cpuacct_cgrp_id)); - else + if (!cgroup_subsys_on_dfl(cpuacct_cgrp_subsys)) { + if (static_branch_likely(&psi_v1_disabled)) + return &psi_system; + else + return cgroup_psi(task_cgroup(task, cpuacct_cgrp_id)); + } else return cgroup_psi(task_dfl_cgroup(task)); -#else - return cgroup_psi(task_dfl_cgroup(task)); -#endif } #endif return &psi_system;