sched/ext: Implement cgroup idle state notification
Subsystems (2)
PATCH v2 1/1 sched/ext: Implement cgroup idle state notification
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 <[email protected]>
--- kernel/sched/ext.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
kernel/sched/ext.c +7 -1
@@ -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 )
Signature · 1 line
2.50.0