提交 dc159a61 编写于 作者: J Joseph Qi 提交者: Caspar Zhang

alinux: introduce psi_v1 boot parameter

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: NJoseph Qi <joseph.qi@linux.alibaba.com>
Acked-by: NXunlei Pang <xlpang@linux.alibaba.com>
上级 1f49a738
...@@ -3598,6 +3598,10 @@ ...@@ -3598,6 +3598,10 @@
tracking. tracking.
Format: <bool> 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 psmouse.proto= [HW,MOUSE] Highest PS2 mouse protocol extension to
probe for; one of (bare|imps|exps|lifebook|any). probe for; one of (bare|imps|exps|lifebook|any).
psmouse.rate= [HW,MOUSE] Set desired mouse report rate, in reports psmouse.rate= [HW,MOUSE] Set desired mouse report rate, in reports
......
...@@ -14,6 +14,8 @@ struct css_set; ...@@ -14,6 +14,8 @@ struct css_set;
extern struct static_key_false psi_disabled; extern struct static_key_false psi_disabled;
extern struct psi_group psi_system; extern struct psi_group psi_system;
extern struct static_key_false psi_v1_disabled;
void psi_init(void); void psi_init(void);
void psi_task_change(struct task_struct *task, int clear, int set); void psi_task_change(struct task_struct *task, int clear, int set);
......
...@@ -532,16 +532,6 @@ config PSI_DEFAULT_DISABLED ...@@ -532,16 +532,6 @@ config PSI_DEFAULT_DISABLED
Say N if unsure. 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" endmenu # "CPU/Task time and stats accounting"
config CPU_ISOLATION config CPU_ISOLATION
......
...@@ -375,8 +375,21 @@ struct cgroup_subsys cpuacct_cgrp_subsys = { ...@@ -375,8 +375,21 @@ struct cgroup_subsys cpuacct_cgrp_subsys = {
}; };
#ifdef CONFIG_PSI #ifdef CONFIG_PSI
static bool psi_v1_enable;
static int __init setup_psi_v1(char *str)
{
return kstrtobool(str, &psi_v1_enable) == 0;
}
__setup("psi_v1=", setup_psi_v1);
static int __init cgroup_v1_psi_init(void) static int __init cgroup_v1_psi_init(void)
{ {
if (!psi_v1_enable) {
static_branch_enable(&psi_v1_disabled);
return 0;
}
cgroup_add_legacy_cftypes(&cpuacct_cgrp_subsys, cgroup_v1_psi_files); cgroup_add_legacy_cftypes(&cpuacct_cgrp_subsys, cgroup_v1_psi_files);
return 0; return 0;
} }
......
...@@ -145,6 +145,7 @@ ...@@ -145,6 +145,7 @@
static int psi_bug __read_mostly; static int psi_bug __read_mostly;
DEFINE_STATIC_KEY_FALSE(psi_disabled); DEFINE_STATIC_KEY_FALSE(psi_disabled);
DEFINE_STATIC_KEY_FALSE(psi_v1_disabled);
#ifdef CONFIG_PSI_DEFAULT_DISABLED #ifdef CONFIG_PSI_DEFAULT_DISABLED
static bool psi_enable; static bool psi_enable;
...@@ -724,13 +725,12 @@ static struct psi_group *iterate_groups(struct task_struct *task, void **iter) ...@@ -724,13 +725,12 @@ static struct psi_group *iterate_groups(struct task_struct *task, void **iter)
#ifdef CONFIG_CGROUPS #ifdef CONFIG_CGROUPS
struct cgroup *cgroup = NULL; struct cgroup *cgroup = NULL;
if (!*iter) if (!*iter) {
#ifdef CONFIG_PSI_CGROUP_V1 if (static_branch_likely(&psi_v1_disabled))
cgroup = task_cgroup(task, cpuacct_cgrp_id); cgroup = task->cgroups->dfl_cgrp;
#else else
cgroup = task->cgroups->dfl_cgrp; cgroup = task_cgroup(task, cpuacct_cgrp_id);
#endif } else if (*iter == &psi_system)
else if (*iter == &psi_system)
return NULL; return NULL;
else else
cgroup = cgroup_parent(*iter); cgroup = cgroup_parent(*iter);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册