[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YIwCvkfrPGkyk17d@google.com>
Date: Fri, 30 Apr 2021 13:14:38 +0000
From: Quentin Perret <qperret@...gle.com>
To: Dietmar Eggemann <dietmar.eggemann@....com>
Cc: Vincent Guittot <vincent.guittot@...aro.org>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Qais Yousef <qais.yousef@....com>,
Android Kernel Team <kernel-team@...roid.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Patrick Bellasi <patrick.bellasi@...bug.net>
Subject: Re: [PATCH v2] sched: Fix out-of-bound access in uclamp
On Friday 30 Apr 2021 at 15:00:00 (+0200), Dietmar Eggemann wrote:
> On 30/04/2021 14:03, Vincent Guittot wrote:
> IMHO, this asks for
>
> min_t(unsigned int, clamp_value/UCLAMP_BUCKET_DELTA, UCLAMP_BUCKETS-1);
Yep, that's what I have locally.
> >> }
> >>
> >> static inline unsigned int uclamp_none(enum uclamp_id clamp_id)
>
> Looks like this will fix a lot of possible configs:
>
> nbr buckets 1-4, 7-8, 10-12, 14-17, *20*, 26, 29-32 ...
>
> We would still introduce larger last buckets, right?
Indeed. The only better alternative I could see was to 'spread' the
error accross multiple buckets (e.g. make the last few buckets a bit
bigger instead of having all of it accumulated on the last one), but not
sure it is worth the overhead.
Suggestions are welcome though.
> Examples:
>
> nbr_buckets delta last bucket size
>
> 20 51 +5 = 56
>
> 26 39 +10 = 49
>
> 29 35 +9 = 44
Yes the error can become worse in the relative sense with a large number
of buckets, but again the max is 20 so we should be fine?
Thanks,
Quentin
Powered by blists - more mailing lists