All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>
Subject: [PATCH 6/6] cpuidle: menu: Move the latency_req == 0 special case check
Date: Tue, 02 Oct 2018 23:47:43 +0200	[thread overview]
Message-ID: <9002841.GWJsep0FYb@aspire.rjw.lan> (raw)
In-Reply-To: <3510260.hvypppS8Bs@aspire.rjw.lan>

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

It is better to always update data->bucket before returning from
menu_select() so as to prevent disturbing the wakeup statistics
collected by the governor, so combine the latency_req == 0 special
check with the more general check below.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpuidle/governors/menu.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Index: linux-pm/drivers/cpuidle/governors/menu.c
===================================================================
--- linux-pm.orig/drivers/cpuidle/governors/menu.c
+++ linux-pm/drivers/cpuidle/governors/menu.c
@@ -297,19 +297,13 @@ static int menu_select(struct cpuidle_dr
 		data->needs_update = 0;
 	}
 
-	/* Special case when user has set very strict latency requirement */
-	if (unlikely(latency_req == 0)) {
-		*stop_tick = false;
-		return 0;
-	}
-
 	/* determine the expected residency time, round up */
 	data->next_timer_us = ktime_to_us(tick_nohz_get_sleep_length(&delta_next));
 
 	get_iowait_load(&nr_iowaiters, &cpu_load);
 	data->bucket = which_bucket(data->next_timer_us, nr_iowaiters);
 
-	if (unlikely(drv->state_count <= 1) ||
+	if (unlikely(drv->state_count <= 1 || latency_req == 0) ||
 	    ((data->next_timer_us < drv->states[1].target_residency ||
 	      latency_req < drv->states[1].exit_latency) &&
 	     !drv->states[0].disabled && !dev->states_usage[0].disable)) {


  parent reply	other threads:[~2018-10-02 21:51 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
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 ` Rafael J. Wysocki [this message]
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=9002841.GWJsep0FYb@aspire.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=peterz@infradead.org \
    /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.