Re: [PATCH] sched/fair: Fix CPU bandwidth limit bypass during CPU hotplug

From: Srikar Dronamraju
Date: Fri Dec 06 2024 - 04:09:17 EST


* Vishal Chourasia <vishalc@xxxxxxxxxxxxx> [2024-11-26 12:18:13]:

> CPU controller limits are not properly enforced during CPU hotplug operations,
> particularly during CPU offline. When a CPU goes offline, throttled
> processes are unintentionally being unthrottled across all CPUs in the system,
> allowing them to exceed their assigned quota limits.
>
<snip>

> Signed-off-by: Vishal Chourasia <vishalc@xxxxxxxxxxxxx>
> ---
> kernel/sched/fair.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index fbdca89c677f..c436e2307e6f 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -6684,7 +6684,8 @@ static void __maybe_unused unthrottle_offline_cfs_rqs(struct rq *rq)
> list_for_each_entry_rcu(tg, &task_groups, list) {
> struct cfs_rq *cfs_rq = tg->cfs_rq[cpu_of(rq)];
>
> - if (!cfs_rq->runtime_enabled)
> + /* Don't unthrottle an active cfs_rq unnecessarily */

Per the patch description, its not just unnecessary but unthrottling is
buggy. Unnecessary would mean its just an overhead. Here we dont want to
unthrottle. Other than that this seems to be fine to me.

> + if (!cfs_rq->runtime_enabled || cpumask_test_cpu(cpu_of(rq), cpu_active_mask))
> continue;

--
Thanks and Regards
Srikar Dronamraju