* [PATCH sched/ext v2] sched/ext: Implement cgroup idle state notification
@ 2025-06-30 18:47 Marcos Garcia
0 siblings, 0 replies; only message in thread
From: Marcos Garcia @ 2025-06-30 18:47 UTC (permalink / raw)
To: tj, void, mingo, peterz
Cc: arighi, changwoo, juri.lelli, vincent.guittot, sched-ext,
linux-kernel, Marcos Garcia
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-06-30 18:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-30 18:47 [PATCH sched/ext v2] sched/ext: Implement cgroup idle state notification Marcos Garcia
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox