Re: [PATCH] sched/ext: add scx_bpf_cgroup_report_throttled kfunc
From: Tejun Heo
Date: Wed May 27 2026 - 15:25:31 EST
Hello,
On Mon, May 25, 2026 at 09:24:32PM +0200, Fernand Sieber wrote:
> +__bpf_kfunc void scx_bpf_cgroup_report_throttled(struct cgroup *cgrp,
> + u64 throttled_ns)
> +{
> +#ifdef CONFIG_CFS_BANDWIDTH
> + struct task_group *tg;
> +
> + rcu_read_lock();
> + tg = cgrp->subsys[cpu_cgrp_id] ?
> + container_of(cgrp->subsys[cpu_cgrp_id], struct task_group, css) :
> + NULL;
> + if (tg) {
> + struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth;
> +
> + raw_spin_lock_irq(&cfs_b->lock);
> + cfs_b->throttled_time += throttled_ns;
> + cfs_b->nr_throttled++;
> + cfs_b->nr_periods++;
> + raw_spin_unlock_irq(&cfs_b->lock);
> + }
> + rcu_read_unlock();
> +#endif
I don't think modifying fair's internal state from scx is a good idea. All
the cgroup piping is split at the interface level. I think it'd be better to
make both cfs and scx report their own numbers and then sum them up in the
output.
Thanks.
--
tejun