All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Linux PM <linux-pm@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/6] cpuidle: menu: Get rid of first_idx from menu_select()
Date: Fri, 5 Oct 2018 10:35:00 +0200	[thread overview]
Message-ID: <b365081f-00bb-ec2a-84b2-48bed1b76c19@linaro.org> (raw)
In-Reply-To: <CAJZ5v0h1Z7MKjq9XY0-tn9U4J3CdycYPbGkM3fjH7-FzaJ=uJA@mail.gmail.com>

On 04/10/2018 19:19, Rafael J. Wysocki wrote:
> On Thu, Oct 4, 2018 at 4:51 PM Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>>
>> On Tue, Oct 02, 2018 at 11:44:06PM +0200, Rafael J. Wysocki wrote:
>>> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>>
>>> Rearrange the code in menu_select() so that the loop over idle states
>>> always starts from 0 and get rid of the first_idx variable.
>>>
>>> While at it, add two empty lines to separate conditional statements
>>> one another.
>>>
>>> No intentional behavior changes.
>>>
>>> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>> ---
>>
>> This code is becoming a bit complex to follow :/
>>
>> May be I missed something, but it is not possible to enter the condition without
>> idx != 0, no ? (I meant the condition if ((drv->states[idx].flags &
>> FLAG_POLLING))
> 
> Not sure what you mean.

Yes, sorry let me clarify.

I meant the flag polling is always on state[0], so if the flag is set
then idx == 0.

We have the conditions:

  drv->states[idx].flags & CPUIDLE_FLAG_POLLING

If it is true then idx is zero.


Then comes the second condition:

  i == idx + 1

because of the above, idx is zero, then it can become i == 1.

Then the variable assignation:

 idx = i can be replaced by idx = 1





> We start with idx = -1, i = 0.  If state[0] is enabled, idx becomes 0.
> 
> If the target residency or exit latency of state[0] are already beyond
> the limits, we just bail out and state[0] will be returned.
> 
> If not, we go to i = 1, but idx is still 0.  If the target residency
> of state[1] is beyond predicted_us (which is the interesting case), we
> check (drv->states[0].flags & FLAG_POLLING) and so on.
> 
> Currently, the polling state must be state[0] (if used at all) anyway.
> 
>> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>>
> 
> Thanks!
> 


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


  reply	other threads:[~2018-10-05  8:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-02 21:41 [PATCH 0/6] cpuidle: menu: Fixes, optimizations and cleanups Rafael J. Wysocki
2018-10-02 21:42 ` [PATCH 1/6] cpuidle: menu: Fix wakeup statistics updates for polling state Rafael J. Wysocki
2018-10-04  8:19   ` Daniel Lezcano
2018-10-02 21:42 ` [PATCH 2/6] cpuidle: menu: Compute first_idx when latency_req is known Rafael J. Wysocki
2018-10-04 14:22   ` Daniel Lezcano
2018-10-02 21:44 ` [PATCH 3/6] cpuidle: menu: Get rid of first_idx from menu_select() Rafael J. Wysocki
2018-10-04  7:46   ` Peter Zijlstra
2018-10-04  7:53     ` Rafael J. Wysocki
2018-10-04  8:00       ` Peter Zijlstra
2018-10-04 14:51   ` Daniel Lezcano
2018-10-04 17:19     ` Rafael J. Wysocki
2018-10-05  8:35       ` Daniel Lezcano [this message]
2018-10-05  8:49         ` Rafael J. Wysocki
2018-10-02 21:45 ` [PATCH 4/6] cpuidle: menu: Do not update last_state_idx in menu_select() Rafael J. Wysocki
2018-10-04 14:57   ` Daniel Lezcano
2018-10-02 21:46 ` [PATCH 5/6] cpuidle: menu: Avoid computations for very close timers Rafael J. Wysocki
2018-10-04 15:50   ` Daniel Lezcano
2018-10-04 17:11     ` Rafael J. Wysocki
2018-10-02 21:47 ` [PATCH 6/6] cpuidle: menu: Move the latency_req == 0 special case check Rafael J. Wysocki
2018-10-04  6:55 ` [PATCH 0/6] cpuidle: menu: Fixes, optimizations and cleanups Rafael J. Wysocki
2018-10-04  7:51   ` Peter Zijlstra

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=b365081f-00bb-ec2a-84b2-48bed1b76c19@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.