[tip: sched/psi] sched/psi: Don't create cgroup PSI files when psi_disabled
From: tip-bot2 for Chengming Zhou
Date: Fri Sep 09 2022 - 10:01:06 EST
The following commit has been merged into the sched/psi branch of tip:
Commit-ID: 58d8c2586cedb8a67f6f0dffa5eaed0f89135b39
Gitweb: https://git.kernel.org/tip/58d8c2586cedb8a67f6f0dffa5eaed0f89135b39
Author: Chengming Zhou <zhouchengming@xxxxxxxxxxxxx>
AuthorDate: Fri, 26 Aug 2022 00:41:03 +08:00
Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CommitterDate: Fri, 09 Sep 2022 11:08:31 +02:00
sched/psi: Don't create cgroup PSI files when psi_disabled
commit 3958e2d0c34e ("cgroup: make per-cgroup pressure stall tracking configurable")
make PSI can be configured to skip per-cgroup stall accounting. And
doesn't expose PSI files in cgroup hierarchy.
This patch do the same thing when psi_disabled.
Signed-off-by: Chengming Zhou <zhouchengming@xxxxxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>
Link: https://lore.kernel.org/r/20220825164111.29534-3-zhouchengming@xxxxxxxxxxxxx
---
kernel/cgroup/cgroup.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 718a70c..96aefdb 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -3780,6 +3780,9 @@ static void cgroup_pressure_release(struct kernfs_open_file *of)
bool cgroup_psi_enabled(void)
{
+ if (static_branch_likely(&psi_disabled))
+ return false;
+
return (cgroup_feature_disable_mask & (1 << OPT_FEATURE_PRESSURE)) == 0;
}