From: Arjan van de Ven <arjan@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: frank.rowand@am.sony.com,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] cpuidle: Add a repeating pattern detector to the menu governor
Date: Fri, 21 May 2010 22:23:23 -0700 [thread overview]
Message-ID: <20100521222323.4799b1ca@infradead.org> (raw)
In-Reply-To: <20100521124309.28e25866.akpm@linux-foundation.org>
On Fri, 21 May 2010 12:43:09 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Wed, 19 May 2010 12:51:50 -0700
> Frank Rowand <frank.rowand@am.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.
yeah that's a bug; I'll make a patch to fix it
>
> > > + 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.
sorry, seems this email got lost in 400 "Suspend block API" emails ;(
>
>
> Also, expected_us is 32-bit and predicted_us is 64-bit. Was that
> rational?
predicted holds intermediate results of some calculations.. and those
overflow 32 bit...
--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
next prev parent reply other threads:[~2010-05-22 5:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-09 23:02 [PATCH 0/2] Some improvements to the cpuidle " Arjan van de Ven
2010-05-09 23:03 ` [PATCH 1/2] cpuidle: Fix incorrect optimziation Arjan van de Ven
2010-05-09 23:04 ` [PATCH 2/2] cpuidle: Add a repeating pattern detector to the menu governor Arjan van de Ven
2010-05-10 21:38 ` Andrew Morton
2010-05-11 1:27 ` Arjan van de Ven
2010-05-10 23:43 ` Andrew Morton
2010-05-19 19:51 ` Frank Rowand
2010-05-21 19:43 ` Andrew Morton
2010-05-22 5:23 ` Arjan van de Ven [this message]
2010-05-22 16:31 ` Arjan van de Ven
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=20100521222323.4799b1ca@infradead.org \
--to=arjan@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=frank.rowand@am.sony.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®