BACKPORT: kernel/sched/psi.c: expose pressure metrics on root cgroup
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 Change-Id: Ie2f8db10835e18421d260147870f1a12898d951b 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>
This commit is contained in:
committed by
bengris32
parent
f985ed0e59
commit
45d8c9e8af
@@ -12,6 +12,7 @@ struct css_set;
|
||||
#ifdef CONFIG_PSI
|
||||
|
||||
extern struct static_key_false psi_disabled;
|
||||
extern struct psi_group psi_system;
|
||||
|
||||
void psi_init(void);
|
||||
|
||||
|
||||
@@ -3562,15 +3562,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);
|
||||
}
|
||||
|
||||
static ssize_t cgroup_pressure_write(struct kernfs_open_file *of, char *buf,
|
||||
@@ -4930,7 +4939,7 @@ static struct cftype cgroup_base_files[] = {
|
||||
#ifdef CONFIG_PSI
|
||||
{
|
||||
.name = "io.pressure",
|
||||
.flags = CFTYPE_NOT_ON_ROOT | CFTYPE_PRESSURE,
|
||||
.flags = CFTYPE_PRESSURE,
|
||||
.seq_show = cgroup_io_pressure_show,
|
||||
.write = cgroup_io_pressure_write,
|
||||
.poll = cgroup_pressure_poll,
|
||||
@@ -4938,7 +4947,7 @@ static struct cftype cgroup_base_files[] = {
|
||||
},
|
||||
{
|
||||
.name = "memory.pressure",
|
||||
.flags = CFTYPE_NOT_ON_ROOT | CFTYPE_PRESSURE,
|
||||
.flags = CFTYPE_PRESSURE,
|
||||
.seq_show = cgroup_memory_pressure_show,
|
||||
.write = cgroup_memory_pressure_write,
|
||||
.poll = cgroup_pressure_poll,
|
||||
@@ -4946,7 +4955,7 @@ static struct cftype cgroup_base_files[] = {
|
||||
},
|
||||
{
|
||||
.name = "cpu.pressure",
|
||||
.flags = CFTYPE_NOT_ON_ROOT | CFTYPE_PRESSURE,
|
||||
.flags = CFTYPE_PRESSURE,
|
||||
.seq_show = cgroup_cpu_pressure_show,
|
||||
.write = cgroup_cpu_pressure_write,
|
||||
.poll = cgroup_pressure_poll,
|
||||
|
||||
@@ -174,7 +174,7 @@ static u64 psi_period __read_mostly;
|
||||
|
||||
/* 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,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user