lkml.org 
[lkml]   [2021]   [Apr]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2] sched: Fix out-of-bound access in uclamp
On Fri, 30 Apr 2021 at 15:14, Quentin Perret <qperret@google.com> wrote:
>
> 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.

I don't think it's 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

\
 
 \ /
  Last update: 2021-04-30 16:17    [W:0.052 / U:0.432 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site