[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <47e3d97d-7dd3-85f5-d790-42b95760c64e@linux.ibm.com>
Date: Thu, 14 May 2020 21:05:37 +0530
From: Pratik Sampat <psampat@...ux.ibm.com>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux PM <linux-pm@...r.kernel.org>,
Rafael Wysocki <rafael.j.wysocki@...el.com>,
Doug Smythies <dsmythies@...us.net>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
"Gautham R. Shenoy" <ego@...ux.vnet.ibm.com>,
Vaidyanathan Srinivasan <svaidy@...ux.ibm.com>,
pratik.sampat@...ibm.com, pratik.r.sampat@...il.com
Subject: Re: [RFC 1/1] Weighted approach to gather and use history in TEO
governor
On 13/05/20 8:19 pm, Rafael J. Wysocki wrote:
> On Wed, May 13, 2020 at 7:31 AM Pratik Sampat <psampat@...ux.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!
Powered by blists - more mailing lists