linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Quentin Perret <qperret@google.com>
To: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	Qais Yousef <qais.yousef@arm.com>,
	Android Kernel Team <kernel-team@android.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Patrick Bellasi <patrick.bellasi@matbug.net>
Subject: Re: [PATCH v2] sched: Fix out-of-bound access in uclamp
Date: Fri, 30 Apr 2021 13:14:38 +0000	[thread overview]
Message-ID: <YIwCvkfrPGkyk17d@google.com> (raw)
In-Reply-To: <b6737247-ca02-e197-70c7-020952d95c1b@arm.com>

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

  reply	other threads:[~2021-04-30 13:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 15:26 [PATCH v2] sched: Fix out-of-bound access in uclamp Quentin Perret
2021-04-30  7:45 ` Vincent Guittot
2021-04-30  8:25   ` Quentin Perret
2021-04-30  8:49     ` Vincent Guittot
2021-04-30  9:40       ` Quentin Perret
2021-04-30 12:03         ` Vincent Guittot
2021-04-30 13:00           ` Dietmar Eggemann
2021-04-30 13:14             ` Quentin Perret [this message]
2021-04-30 14:16               ` Vincent Guittot
2021-04-30 15:04                 ` Dietmar Eggemann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YIwCvkfrPGkyk17d@google.com \
    --to=qperret@google.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=patrick.bellasi@matbug.net \
    --cc=peterz@infradead.org \
    --cc=qais.yousef@arm.com \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).