public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: void@manifault.com, peterz@infradead.org, mingo@redhat.com
Cc: cgroups@vger.kernel.org, lizefan.x@bytedance.com,
	hannes@cmpxchg.org, mkoutny@suse.com, kernel-team@meta.com,
	linux-kernel@vger.kernel.org, Tejun Heo <tj@kernel.org>,
	David Vernet <dvernet@meta.com>, Josh Don <joshdon@google.com>,
	Hao Luo <haoluo@google.com>, Barret Rhoden <brho@google.com>
Subject: [PATCH 2/7] sched: Expose css_tg()
Date: Wed,  7 Aug 2024 14:25:24 -1000	[thread overview]
Message-ID: <20240808002550.731248-3-tj@kernel.org> (raw)
In-Reply-To: <20240808002550.731248-1-tj@kernel.org>

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@kernel.org>
Reviewed-by: David Vernet <dvernet@meta.com>
Acked-by: Josh Don <joshdon@google.com>
Acked-by: Hao Luo <haoluo@google.com>
Acked-by: Barret Rhoden <brho@google.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 0e64a9362aa1..c9678614e476 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -8918,11 +8918,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 9373426d5aae..e38e25d00d88 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -514,6 +514,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


  parent reply	other threads:[~2024-08-08  0:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-08  0:25 [PATCHSET sched_ext/for-6.12] sched_ext: Add cgroup support Tejun Heo
2024-08-08  0:25 ` [PATCH 1/7] cgroup: Implement cgroup_show_cftypes() Tejun Heo
2024-08-20 14:38   ` Michal Koutný
2024-08-26 18:35     ` Tejun Heo
2024-08-08  0:25 ` Tejun Heo [this message]
2024-08-08  0:25 ` [PATCH 3/7] sched: Enumerate CPU cgroup file types Tejun Heo
2024-08-08  0:25 ` [PATCH 4/7] sched: Make cpu_shares_read_u64() use tg_weight() Tejun Heo
2024-08-08 17:38   ` David Vernet
2024-08-08  0:25 ` [PATCH 5/7] sched: Introduce CONFIG_GROUP_SCHED_WEIGHT Tejun Heo
2024-08-08  0:25 ` [PATCH 6/7] sched_ext: Add cgroup support Tejun Heo
2024-08-08  0:25 ` [PATCH 7/7] sched_ext: Add a cgroup scheduler which uses flattened hierarchy Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240808002550.731248-3-tj@kernel.org \
    --to=tj@kernel.org \
    --cc=brho@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=dvernet@meta.com \
    --cc=hannes@cmpxchg.org \
    --cc=haoluo@google.com \
    --cc=joshdon@google.com \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan.x@bytedance.com \
    --cc=mingo@redhat.com \
    --cc=mkoutny@suse.com \
    --cc=peterz@infradead.org \
    --cc=void@manifault.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox