Re: [PATCH] sched/fair: Fix CPU bandwidth limit bypass during CPU hotplug
From: Vishal Chourasia
Date: Sat Dec 07 2024 - 00:25:08 EST
On Fri, Dec 06, 2024 at 02:37:54PM +0530, Srikar Dronamraju wrote:
> * 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.
sure.
Also, I missed running the patch against checkpatch.pl
Will be sending out v2 with the updates.
vishalc
>
> > + if (!cfs_rq->runtime_enabled || cpumask_test_cpu(cpu_of(rq), cpu_active_mask))
> > continue;
>
> --
> Thanks and Regards
> Srikar Dronamraju