summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChengming Zhou <zhouchengming@bytedance.com>2022-08-25 18:41:09 +0200
committerPeter Zijlstra <peterz@infradead.org>2022-09-09 11:08:33 +0200
commit57899a6610e67ba26fa3251ebbef4a5ed21efc5d (patch)
treecd4fe1689b8e0f4001966dba898bd9e809a86152 /include
parentsched/psi: Add PSI_IRQ to track IRQ/SOFTIRQ pressure (diff)
downloadlinux-57899a6610e67ba26fa3251ebbef4a5ed21efc5d.tar.xz
linux-57899a6610e67ba26fa3251ebbef4a5ed21efc5d.zip
sched/psi: Consolidate cgroup_psi()
cgroup_psi() can't return psi_group for root cgroup, so we have many open code "psi = cgroup_ino(cgrp) == 1 ? &psi_system : cgrp->psi". This patch move cgroup_psi() definition to <linux/psi.h>, in which we can return psi_system for root cgroup, so can handle all cgroups. Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Link: https://lore.kernel.org/r/20220825164111.29534-9-zhouchengming@bytedance.com
Diffstat (limited to 'include')
-rw-r--r--include/linux/cgroup.h5
-rw-r--r--include/linux/psi.h6
2 files changed, 6 insertions, 5 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index b0914aa26506..80cb970257be 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -673,11 +673,6 @@ static inline void pr_cont_cgroup_path(struct cgroup *cgrp)
pr_cont_kernfs_path(cgrp->kn);
}
-static inline struct psi_group *cgroup_psi(struct cgroup *cgrp)
-{
- return cgrp->psi;
-}
-
bool cgroup_psi_enabled(void);
static inline void cgroup_init_kthreadd(void)
diff --git a/include/linux/psi.h b/include/linux/psi.h
index fffd229fbf19..362a74ca1d3b 100644
--- a/include/linux/psi.h
+++ b/include/linux/psi.h
@@ -7,6 +7,7 @@
#include <linux/sched.h>
#include <linux/poll.h>
#include <linux/cgroup-defs.h>
+#include <linux/cgroup.h>
struct seq_file;
struct css_set;
@@ -30,6 +31,11 @@ __poll_t psi_trigger_poll(void **trigger_ptr, struct file *file,
poll_table *wait);
#ifdef CONFIG_CGROUPS
+static inline struct psi_group *cgroup_psi(struct cgroup *cgrp)
+{
+ return cgroup_ino(cgrp) == 1 ? &psi_system : cgrp->psi;
+}
+
int psi_cgroup_alloc(struct cgroup *cgrp);
void psi_cgroup_free(struct cgroup *cgrp);
void cgroup_move_task(struct task_struct *p, struct css_set *to);