From: Marcos Garcia <magazo2005@gmail.com>
To: tj@kernel.org, void@manifault.com, mingo@redhat.com,
peterz@infradead.org
Cc: arighi@nvidia.com, changwoo@igalia.com, juri.lelli@redhat.com,
vincent.guittot@linaro.org, sched-ext@lists.linux.dev,
linux-kernel@vger.kernel.org,
Marcos Garcia <magazo2005@gmail.com>
Subject: [PATCH sched/ext v2] sched/ext: Implement cgroup idle state notification
Date: Mon, 30 Jun 2025 20:47:09 +0200 [thread overview]
Message-ID: <20250630184709.3831581-1-magazo2005@gmail.com> (raw)
Add scx_group_set_idle() to notify BPF schedulers when task groups become
idle or active. This enables schedulers to:
- Optimize resource allocation for inactive cgroups
- Implement power-saving policies
- Improve load balancing decisions
The implementation safely invokes the BPF scheduler's cgroup_set_idle
callback under RCU protection. The callback is optional - schedulers
not needing this notification can omit it.
Signed-off-by: Marcos Garcia <magazo2005@gmail.com>
---
kernel/sched/ext.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index b498d867ba21..7cecc0ca700d 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -4258,7 +4258,13 @@ void scx_group_set_weight(struct task_group *tg, unsigned long weight)
void scx_group_set_idle(struct task_group *tg, bool idle)
{
- /* TODO: Implement ops->cgroup_set_idle() */
+ struct sched_ext_ops *ops;
+
+ rcu_read_lock();
+ ops = rcu_dereference(ext_ops);
+ if (ops && ops->cgroup_set_idle)
+ ops->cgroup_set_idle(tg, idle);
+ rcu_read_unlock();
}
static void scx_cgroup_lock(void)
--
2.50.0
reply other threads:[~2025-06-30 18:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20250630184709.3831581-1-magazo2005@gmail.com \
--to=magazo2005@gmail.com \
--cc=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=sched-ext@lists.linux.dev \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.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