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: <20100521124309.28e25866.akpm@linux-foundation.org>
Date:	Fri, 21 May 2010 12:43:09 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	frank.rowand@...sony.com
Cc:	Arjan van de Ven <arjan@...radead.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] cpuidle: Add a repeating pattern detector to the
 menu governor

On Wed, 19 May 2010 12:51:50 -0700
Frank Rowand <frank.rowand@...sony.com> wrote:

> Aplogies if this is a duplicate, my outgoing email seems to have not
> been working.
> 
> On 05/09/10 16:04, Arjan van de Ven wrote:
> 
> > +/*
> > + * Try detecting repeating patterns by keeping track of the last 8
> > + * intervals, and checking if the standard deviation of that set
> > + * of points is below a threshold. If it is... then use the
> > + * average of these 8 points as the estimated value.
> > + */
> > +static void detect_repeating_patterns(struct menu_device *data)
> > +{
> > +	int i;
> > +	uint64_t avg = 0;
> > +	uint64_t stddev = 0; /* contains the square of the std deviation */
> > +
> > +	/* first calculate average and standard deviation of the past */
> > +	for (i = 0; i < INTERVALS; i++)
> > +		avg += data->intervals[i];
> > +
> > +	/* if the avg is beyond the known next tick, it's worthless */
> > +	if (avg > data->expected_us)
> > +		return;
> > +
> 
> Should the following division by INTERVALS be moved up 6 lines to before
> "if (avg > data->expected_us)"?

Quite possibly.

> > +	avg = avg / INTERVALS;
> > +	for (i = 0; i < INTERVALS; i++)
> > +		stddev += (data->intervals[i] - avg) *
> > +			  (data->intervals[i] - avg);
> > +
> > +	stddev = stddev / INTERVALS;
> > +
> > +	/*
> > +	 * now.. if stddev is small.. then assume we have a
> > +	 * repeating pattern and predict we keep doing this.
> > +	 */
> > +
> > +	if (avg && stddev < STDDEV_THRESH)
> > +		data->predicted_us = avg;
> > +}

wakey wakey, Arjan.


Also, expected_us is 32-bit and predicted_us is 64-bit.  Was that rational?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ