LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Pratik Sampat <psampat@linux.ibm.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
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: Thu, 14 May 2020 21:05:37 +0530	[thread overview]
Message-ID: <47e3d97d-7dd3-85f5-d790-42b95760c64e@linux.ibm.com> (raw)
In-Reply-To: <CAJZ5v0jOGRQv1EUEhkba30OKuS8aupdoGConKJH9C=R6DxptFA@mail.gmail.com>



On 13/05/20 8:19 pm, Rafael J. Wysocki wrote:
> 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).

Yes you're right. Looking at it now the whole percent system and divisions
does seem quite unnecessary and we can achieve it rather with bitwise
operations.

Thanks!


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

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11 14:10 [RFC 0/1] Alternate history mechanism for the " 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
2020-05-14 15:35         ` Pratik Sampat [this message]
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
  -- strict thread matches above, loose matches on Subject: below --
2020-02-22  7:00 [RFC 0/1] Weighted approach to gather and use history in " Pratik Rajesh Sampat
2020-02-22  7:00 ` [RFC 1/1] " Pratik Rajesh Sampat
2020-02-25  6:18   ` Gautham R Shenoy
2020-02-29  8:58     ` Pratik Sampat

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=47e3d97d-7dd3-85f5-d790-42b95760c64e@linux.ibm.com \
    --to=psampat@linux.ibm.com \
    --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=rafael.j.wysocki@intel.com \
    --cc=rafael@kernel.org \
    --cc=svaidy@linux.ibm.com \
    --subject='Re: [RFC 1/1] Weighted approach to gather and use history in TEO governor' \
    /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

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).