mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Loehle <christian.loehle@arm.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Linux PM <linux-pm@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Subject: Re: [PATCH v1 2/9] cpuidle: teo: Reorder candidate state index checks
Date: Wed, 15 Jan 2025 19:20:30 +0000	[thread overview]
Message-ID: <a44d8a62-8753-4efb-8c3a-f9c3cdc1dabc@arm.com> (raw)
In-Reply-To: <CAJZ5v0iVOg5CnYo8OQ5E8VGLdn4cvVdFFQqpOgpWvij4a4cdxQ@mail.gmail.com>

On 1/15/25 15:54, Rafael J. Wysocki wrote:
> On Wed, Jan 15, 2025 at 3:46 PM Christian Loehle
> <christian.loehle@arm.com> wrote:
>>
>> On 1/13/25 18:36, Rafael J. Wysocki wrote:
>>> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>>
>>> Since constraint_idx may be 0, the candidate state index may change to 0
>>> after assigning constraint_idx to it, so first check if it is greater
>>> than constraint_idx (and update it if so) and then check it against 0.
>>
>> So the reason I've left this where it was is because the prev_intercept_idx
>> was supposed to query the sleep length if we're in an majority-intercept
>> period and then it makes sense to query the sleep length (to detect such
>> a period being over).
>> A constraint_idx == 0 scenario doesn't need the intercept-machinery to
>> work at all, why are we querying the sleep length then?
> 
> In case the constraint is different next time and it's better to know
> the sleep length to properly classify the wakeup.

I would hope constraints change nowhere near as frequently as
idle entry / exit happen, is your experience different?

> 
>>>
>>> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>> ---
>>>
>>> This is a rebased variant of
>>>
>>> https://lore.kernel.org/linux-pm/8476650.T7Z3S40VBb@rjwysocki.net/
>>>
>>> ---
>>>  drivers/cpuidle/governors/teo.c |   15 ++++++++-------
>>>  1 file changed, 8 insertions(+), 7 deletions(-)
>>>
>>> --- a/drivers/cpuidle/governors/teo.c
>>> +++ b/drivers/cpuidle/governors/teo.c
>>> @@ -428,6 +428,14 @@
>>>                               break;
>>>               }
>>>       }
>>> +
>>> +     /*
>>> +      * If there is a latency constraint, it may be necessary to select an
>>> +      * idle state shallower than the current candidate one.
>>> +      */
>>> +     if (idx > constraint_idx)
>>> +             idx = constraint_idx;
>>> +
>>>       if (!idx && prev_intercept_idx) {
>>>               /*
>>>                * We have to query the sleep length here otherwise we don't
>>> @@ -439,13 +447,6 @@
>>>       }
>>>
>>>       /*
>>> -      * If there is a latency constraint, it may be necessary to select an
>>> -      * idle state shallower than the current candidate one.
>>> -      */
>>> -     if (idx > constraint_idx)
>>> -             idx = constraint_idx;
>>> -
>>> -     /*
>>
>> We could leave this here and just do goto end;?
> 
> Why would this be better?

Saves querying the sleep length in case of constraint_idx == 0, i.e.
qos request to be very latency-sensitive and us actually adding latency
here.


  reply	other threads:[~2025-01-15 19:20 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13 18:32 [PATCH v1 0/9] cpuidle: teo: Cleanups and very frequent wakeups handling update Rafael J. Wysocki
2025-01-13 18:34 ` [PATCH v1 1/9] cpuidle: teo: Rearrange idle state lookup code Rafael J. Wysocki
2025-01-15 14:21   ` Christian Loehle
2025-01-13 18:36 ` [PATCH v1 2/9] cpuidle: teo: Reorder candidate state index checks Rafael J. Wysocki
2025-01-15 14:46   ` Christian Loehle
2025-01-15 15:54     ` Rafael J. Wysocki
2025-01-15 19:20       ` Christian Loehle [this message]
2025-01-15 20:48         ` Rafael J. Wysocki
2025-01-15 21:10           ` Rafael J. Wysocki
2025-01-16 12:22             ` Rafael J. Wysocki
2025-01-16 13:26               ` Christian Loehle
2025-01-16 13:27   ` Christian Loehle
2025-01-13 18:39 ` [PATCH v1 3/9] cpuidle: teo: Combine candidate state index checks against 0 Rafael J. Wysocki
2025-01-15 19:44   ` Christian Loehle
2025-01-13 18:40 ` [PATCH v1 4/9] cpuidle: teo: Drop local variable prev_intercept_idx Rafael J. Wysocki
2025-01-15 19:46   ` Christian Loehle
2025-01-13 18:41 ` [PATCH v1 5/9] cpuidle: teo: Clarify two code comments Rafael J. Wysocki
2025-01-15 19:43   ` Christian Loehle
2025-01-13 18:45 ` [PATCH v1 6/9] cpuidle: teo: Simplify counting events used for tick management Rafael J. Wysocki
2025-01-20 11:27   ` Christian Loehle
2025-01-13 18:48 ` [PATCH v1 7/9] cpuidle: teo: Skip getting the sleep length is wakeups are very frequent Rafael J. Wysocki
2025-01-20 12:08   ` Christian Loehle
2025-01-20 16:24     ` Rafael J. Wysocki
2025-01-13 18:50 ` [PATCH v1 8/9] cpuidle: teo: Simplify handling of total events count Rafael J. Wysocki
2025-01-20 12:10   ` Christian Loehle
2025-01-13 18:51 ` [PATCH v1 9/9] cpuidle: teo: Replace time_span_ns with a flag Rafael J. Wysocki
2025-01-20 12:16   ` Christian Loehle
2025-01-20 12:42     ` Rafael J. Wysocki
2025-01-15 14:52 ` [PATCH v1 0/9] cpuidle: teo: Cleanups and very frequent wakeups handling update Christian Loehle
2025-01-20  8:17   ` Aboorva Devarajan
2025-01-20 16:26     ` Rafael J. Wysocki
2025-01-20 16:24   ` Rafael J. Wysocki

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=a44d8a62-8753-4efb-8c3a-f9c3cdc1dabc@arm.com \
    --to=christian.loehle@arm.com \
    --cc=artem.bityutskiy@linux.intel.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.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 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®