From bd3983c8a85b5e69e0e7596449824d8b419af746 Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Mon, 1 Feb 2021 15:31:40 -0800 Subject: [PATCH] ANDROID: make per-cgroup PSI tracking configurable With cgroup v2 hierarchy enabled PSI accounts stalls for each cgroup separately and aggregates at each level of the hierarchy. That causes additional overhead since psi_avgs_work would be called for each cgroup in the hierarchy. In Android we use PSI only at the system level, therefore this overhead can be avoided. Introduce CONFIG_PSI_PER_CGROUP_ACCT that controls per-cgroup PSI tracking and is disabled by default. Bug: 178872719 Signed-off-by: Suren Baghdasaryan Change-Id: I70a418aba76b46a27eb9e66080434aa870496384 --- init/Kconfig | 15 +++++++++++++++ kernel/sched/psi.c | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/init/Kconfig b/init/Kconfig index 9603a5828317..228a0a4d49c0 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -636,6 +636,21 @@ config PSI_DEFAULT_DISABLED Say N if unsure. +config PSI_PER_CGROUP_ACCT + bool "Enable per-cgroup pressure stall information tracking" + default n + depends on PSI + depends on CGROUPS + help + If set, pressure stall information will be tracked for each + individual cgroup. Otherwise, pressure stall information will + be tracked only at the system level under /proc/pressure/. + + This feature generates overhead that depends on the number of + cgroups in the cgroup v2 hierarchy. + + Say N if unsure. + endmenu # "CPU/Task time and stats accounting" config CPU_ISOLATION diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index 967732c0766c..fcc46032ddde 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -743,7 +743,7 @@ static void psi_group_change(struct psi_group *group, int cpu, static struct psi_group *iterate_groups(struct task_struct *task, void **iter) { -#ifdef CONFIG_CGROUPS +#if defined CONFIG_CGROUPS && defined CONFIG_PSI_PER_CGROUP_ACCT struct cgroup *cgroup = NULL; if (!*iter)