提交 1f49a738 编写于 作者: X Xunlei Pang 提交者: Caspar Zhang

alinux: psi: Support PSI under cgroup v1

Export "cpu|io|memory.pressure" under cgroup v1 "cpuacct" subsystem.
Reviewed-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Signed-off-by: NXunlei Pang <xlpang@linux.alibaba.com>
上级 3e25ac47
......@@ -532,6 +532,16 @@ 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
......
......@@ -3518,6 +3518,34 @@ static void cgroup_pressure_release(struct kernfs_open_file *of)
{
psi_trigger_replace(&of->priv, NULL);
}
struct cftype cgroup_v1_psi_files[] = {
{
.name = "io.pressure",
.flags = CFTYPE_NO_PREFIX,
.seq_show = cgroup_io_pressure_show,
.write = cgroup_io_pressure_write,
.poll = cgroup_pressure_poll,
.release = cgroup_pressure_release,
},
{
.name = "memory.pressure",
.flags = CFTYPE_NO_PREFIX,
.seq_show = cgroup_memory_pressure_show,
.write = cgroup_memory_pressure_write,
.poll = cgroup_pressure_poll,
.release = cgroup_pressure_release,
},
{
.name = "cpu.pressure",
.flags = CFTYPE_NO_PREFIX,
.seq_show = cgroup_cpu_pressure_show,
.write = cgroup_cpu_pressure_write,
.poll = cgroup_pressure_poll,
.release = cgroup_pressure_release,
},
{ } /* terminate */
};
#endif /* CONFIG_PSI */
static int cgroup_file_open(struct kernfs_open_file *of)
......
......@@ -373,3 +373,13 @@ struct cgroup_subsys cpuacct_cgrp_subsys = {
.legacy_cftypes = files,
.early_init = true,
};
#ifdef CONFIG_PSI
static int __init cgroup_v1_psi_init(void)
{
cgroup_add_legacy_cftypes(&cpuacct_cgrp_subsys, cgroup_v1_psi_files);
return 0;
}
late_initcall_sync(cgroup_v1_psi_init);
#endif
......@@ -725,7 +725,11 @@ static struct psi_group *iterate_groups(struct task_struct *task, void **iter)
struct cgroup *cgroup = NULL;
if (!*iter)
#ifdef CONFIG_PSI_CGROUP_V1
cgroup = task_cgroup(task, cpuacct_cgrp_id);
#else
cgroup = task->cgroups->dfl_cgrp;
#endif
else if (*iter == &psi_system)
return NULL;
else
......
......@@ -2251,3 +2251,7 @@ unsigned long scale_irq_capacity(unsigned long util, unsigned long irq, unsigned
return util;
}
#endif
#ifdef CONFIG_PSI
extern struct cftype cgroup_v1_psi_files[];
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册