[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240826225822.791578-2-tj@kernel.org>
Date: Mon, 26 Aug 2024 12:57:39 -1000
From: Tejun Heo <tj@...nel.org>
To: void@...ifault.com,
peterz@...radead.org,
mingo@...hat.com
Cc: cgroups@...r.kernel.org,
lizefan.x@...edance.com,
hannes@...xchg.org,
mkoutny@...e.com,
kernel-team@...a.com,
linux-kernel@...r.kernel.org,
Tejun Heo <tj@...nel.org>,
David Vernet <dvernet@...a.com>,
Josh Don <joshdon@...gle.com>,
Hao Luo <haoluo@...gle.com>,
Barret Rhoden <brho@...gle.com>
Subject: [PATCH 1/5] sched: Expose css_tg()
A new BPF extensible sched_class will use css_tg() in the init and exit
paths to visit all task_groups by walking cgroups.
v4: __setscheduler_prio() is already exposed. Dropped from this patch.
v3: Dropped SCHED_CHANGE_BLOCK() as upstream is adding more generic cleanup
mechanism.
v2: Expose SCHED_CHANGE_BLOCK() too and update the description.
Signed-off-by: Tejun Heo <tj@...nel.org>
Reviewed-by: David Vernet <dvernet@...a.com>
Acked-by: Josh Don <joshdon@...gle.com>
Acked-by: Hao Luo <haoluo@...gle.com>
Acked-by: Barret Rhoden <brho@...gle.com>
---
kernel/sched/core.c | 5 -----
kernel/sched/sched.h | 5 +++++
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index b0cec06bb1fa..a59ac9b11e3b 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -8957,11 +8957,6 @@ void sched_move_task(struct task_struct *tsk)
}
}
-static inline struct task_group *css_tg(struct cgroup_subsys_state *css)
-{
- return css ? container_of(css, struct task_group, css) : NULL;
-}
-
static struct cgroup_subsys_state *
cpu_cgroup_css_alloc(struct cgroup_subsys_state *parent_css)
{
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 2416b3866256..07333c545ddc 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -515,6 +515,11 @@ static inline int walk_tg_tree(tg_visitor down, tg_visitor up, void *data)
return walk_tg_tree_from(&root_task_group, down, up, data);
}
+static inline struct task_group *css_tg(struct cgroup_subsys_state *css)
+{
+ return css ? container_of(css, struct task_group, css) : NULL;
+}
+
extern int tg_nop(struct task_group *tg, void *data);
#ifdef CONFIG_FAIR_GROUP_SCHED
--
2.46.0
Powered by blists - more mailing lists