hi,新朋:
这个补丁检查出有一个 fix 补丁,麻烦一次合入下。
谢谢。
WARNING: **NEW BUGFIX** may exists in mainline kernel
git log --grep "df5ba5be7425" --grep "kernel/sched/psi.c: expose pressure metrics on root cgroup"
new fix: 385aac151941 ("cgroup: fix psi monitor for root cgroup")
在 2021/10/15 16:21, Liu Xinpeng 写道:
From: Dan Schatzberg dschatzberg@fb.com
mainline inclusion from mainline-v5.4 commit df5ba5be7425e1df296d40c5f37a39d98ec666a2 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I47QS2 CVE: NA
Pressure metrics are already recorded and exposed in procfs for the entire system, but any tool which monitors cgroup pressure has to special case the root cgroup to read from procfs. This patch exposes the already recorded pressure metrics on the root cgroup.
Link: http://lkml.kernel.org/r/20190510174938.3361741-1-dschatzberg@fb.com Signed-off-by: Dan Schatzberg dschatzberg@fb.com Acked-by: Johannes Weiner hannes@cmpxchg.org Cc: Tejun Heo tj@kernel.org Cc: Li Zefan lizefan@huawei.com Cc: Ingo Molnar mingo@redhat.com Cc: Peter Zijlstra peterz@infradead.org Signed-off-by: Andrew Morton akpm@linux-foundation.org Signed-off-by: Linus Torvalds torvalds@linux-foundation.org Signed-off-by: Liu Xinpeng liuxp11@chinatelecom.cn Signed-off-by: Ctyun Kernel ctyuncommiter01@chinatelecom.cn
include/linux/psi.h | 1 + kernel/cgroup/cgroup.c | 18 ++++++++++++------ kernel/sched/psi.c | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/include/linux/psi.h b/include/linux/psi.h index 7006008..b981e5c 100644 --- a/include/linux/psi.h +++ b/include/linux/psi.h @@ -11,6 +11,7 @@ #ifdef CONFIG_PSI
extern struct static_key_false psi_disabled; +extern struct psi_group psi_system;
void psi_init(void);
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 71ac258..c9f5127 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -3427,15 +3427,24 @@ static int cpu_stat_show(struct seq_file *seq, void *v) #ifdef CONFIG_PSI static int cgroup_io_pressure_show(struct seq_file *seq, void *v) {
- return psi_show(seq, &seq_css(seq)->cgroup->psi, PSI_IO);
- struct cgroup *cgroup = seq_css(seq)->cgroup;
- struct psi_group *psi = cgroup->id == 1 ? &psi_system : &cgroup->psi;
- return psi_show(seq, psi, PSI_IO); } static int cgroup_memory_pressure_show(struct seq_file *seq, void *v) {
- return psi_show(seq, &seq_css(seq)->cgroup->psi, PSI_MEM);
- struct cgroup *cgroup = seq_css(seq)->cgroup;
- struct psi_group *psi = cgroup->id == 1 ? &psi_system : &cgroup->psi;
- return psi_show(seq, psi, PSI_MEM); } static int cgroup_cpu_pressure_show(struct seq_file *seq, void *v) {
- return psi_show(seq, &seq_css(seq)->cgroup->psi, PSI_CPU);
- struct cgroup *cgroup = seq_css(seq)->cgroup;
- struct psi_group *psi = cgroup->id == 1 ? &psi_system : &cgroup->psi;
- return psi_show(seq, psi, PSI_CPU); } #endif
@@ -4623,17 +4632,14 @@ static ssize_t cgroup_threads_write(struct kernfs_open_file *of, #ifdef CONFIG_PSI { .name = "io.pressure",
.seq_show = cgroup_io_pressure_show, }, { .name = "memory.pressure",.flags = CFTYPE_NOT_ON_ROOT,
.seq_show = cgroup_memory_pressure_show, }, { .name = "cpu.pressure",.flags = CFTYPE_NOT_ON_ROOT,
.seq_show = cgroup_cpu_pressure_show, }, #endif.flags = CFTYPE_NOT_ON_ROOT,
diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index 1b99eef..b1eb45c 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -161,7 +161,7 @@ static int __init setup_psi(char *str)
/* System-level pressure and stall tracking */ static DEFINE_PER_CPU(struct psi_group_cpu, system_group_pcpu); -static struct psi_group psi_system = { +struct psi_group psi_system = { .pcpu = &system_group_pcpu, };