lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160120202242.GL6356@twins.programming.kicks-ass.net>
Date:	Wed, 20 Jan 2016 21:22:42 +0100
From:	Peter Zijlstra <peterz@...radead.org>
To:	Nicolas Pitre <nicolas.pitre@...aro.org>
Cc:	Daniel Lezcano <daniel.lezcano@...aro.org>, tglx@...utronix.de,
	rafael@...nel.org, linux-pm@...r.kernel.org,
	linux-kernel@...r.kernel.org, vincent.guittot@...aro.org
Subject: Re: [RFC V2 2/2] sched: idle: IRQ based next prediction for idle
 period

On Wed, Jan 20, 2016 at 02:57:07PM -0500, Nicolas Pitre wrote:
> On Wed, 20 Jan 2016, Peter Zijlstra wrote:
> 
> > On Wed, Jan 20, 2016 at 05:00:33PM +0100, Daniel Lezcano wrote:
> > > +static inline u32 stats_mean(struct stats *s)
> > > +{
> > > +	/*
> > > +	 * gcc is smart enough to convert to a bits shift when the
> > > +	 * divisor is constant and multiple of 2^x.
> > > +	 *
> > > +	 * The number of values could have not reached STATS_NR_VALUES
> > > +	 * yet, but we can consider it acceptable as the situation is
> > > +	 * only at the beginning of the burst of irqs.
> > > +	 */
> > > +	return s->sum / STATS_NR_VALUES;
> > > +}
> > 
> > Note that ->sum is u64, so you're very prone to truncation.
> 
> It won't.  It is the sum of u32 values, so the mean of those values 
> can't exceed 32 bits.

Ah indeed!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ