linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Pratik Sampat <psampat@linux.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Rafael Wysocki <rafael.j.wysocki@intel.com>,
	Doug Smythies <dsmythies@telus.net>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	"Gautham R. Shenoy" <ego@linux.vnet.ibm.com>,
	Vaidyanathan Srinivasan <svaidy@linux.ibm.com>,
	pratik.sampat@in.ibm.com, pratik.r.sampat@gmail.com
Subject: Re: [RFC 1/1] Weighted approach to gather and use history in TEO governor
Date: Wed, 13 May 2020 16:49:47 +0200	[thread overview]
Message-ID: <CAJZ5v0jOGRQv1EUEhkba30OKuS8aupdoGConKJH9C=R6DxptFA@mail.gmail.com> (raw)
In-Reply-To: <09b8bf40-e371-e1eb-d77e-6c676f22dd29@linux.ibm.com>

On Wed, May 13, 2020 at 7:31 AM Pratik Sampat <psampat@linux.ibm.com> wrote:
>
> Thanks for your comment.
>
>
> On 12/05/20 11:07 pm, Peter Zijlstra wrote:
> > Just a quick note..
> >
> > On Mon, May 11, 2020 at 07:40:55PM +0530, Pratik Rajesh Sampat wrote:
> >
> >> +    /*
> >> +     * Rearrange the weight distribution of the state, increase the weight
> >> +     * by the LEARNING RATE % for the idle state that was supposed to be
> >> +     * chosen and reduce by the same amount for rest of the states
> >> +     *
> >> +     * If the weights are greater than (100 - LEARNING_RATE) % or lesser
> >> +     * than LEARNING_RATE %, do not increase or decrease the confidence
> >> +     * respectively
> >> +     */
> >> +    for (i = 0; i < drv->state_count; i++) {
> >> +            unsigned int delta;
> >> +
> >> +            if (idx == -1)
> >> +                    break;
> >> +            if (i ==  idx) {
> >> +                    delta = (LEARNING_RATE * cpu_data->state_mat[last_idx][i]) / 100;
> > 100 is a crap number to divide by as a computer. We bio-puddings happend
> > to have 10 digits, so 100 makes sense to us, but it does not to our
> > binary friends.
> >
> >
> Absolutely! I just wrote the code exactly the way I did the Math on paper,
> definitely need to figure out an optimal way of doing things.

There is no particular reason to use percent in computations at all.
You may as well use 1/1024 parts instead (and then use shifts instead
of divisions).

  reply	other threads:[~2020-05-13 15:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11 14:10 [RFC 0/1] Alternate history mechanism for the TEO governor Pratik Rajesh Sampat
2020-05-11 14:10 ` [RFC 1/1] Weighted approach to gather and use history in " Pratik Rajesh Sampat
2020-05-12 17:37   ` Peter Zijlstra
2020-05-13  5:31     ` Pratik Sampat
2020-05-13 14:49       ` Rafael J. Wysocki [this message]
2020-05-14 15:35         ` Pratik Sampat
2020-05-17 18:11 ` [RFC 0/1] Alternate history mechanism for the " Doug Smythies
2020-05-21 11:09   ` Pratik Sampat
2020-05-25 18:32     ` Doug Smythies

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='CAJZ5v0jOGRQv1EUEhkba30OKuS8aupdoGConKJH9C=R6DxptFA@mail.gmail.com' \
    --to=rafael@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=dsmythies@telus.net \
    --cc=ego@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=pratik.r.sampat@gmail.com \
    --cc=pratik.sampat@in.ibm.com \
    --cc=psampat@linux.ibm.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=svaidy@linux.ibm.com \
    /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).