From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Linux PM list <linux-pm@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Sudeep Holla <sudeep.holla@arm.com>
Subject: [PATCH 1/2] sched / idle: Drop default_idle_call() fallback from call_cpuidle()
Date: Sat, 16 Jan 2016 00:54:53 +0100 [thread overview]
Message-ID: <2393290.LAksQzHH19@vostro.rjw.lan> (raw)
In-Reply-To: <1621492.NI2xz9vt7M@vostro.rjw.lan>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
After commit 9c4b2867ed7c (cpuidle: menu: Fix menu_select() for
CPUIDLE_DRIVER_STATE_START == 0) it is clear that menu_select()
cannot return negative values. Moreover, ladder_select_state()
will never return a negative value too, so make find_deepest_state()
return non-negative values too and drop the default_idle_call()
fallback from call_cpuidle().
This eliminates one branch from the idle loop and makes the governors
and find_deepest_state() handle the case when all states have been
disabled from sysfs consistently.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
Note: Commit 9c4b2867ed7c (cpuidle: menu: Fix menu_select() for
CPUIDLE_DRIVER_STATE_START == 0) is in linux-next only ATM.
---
drivers/cpuidle/cpuidle.c | 6 +++---
kernel/sched/idle.c | 6 ------
2 files changed, 3 insertions(+), 9 deletions(-)
Index: linux-pm/drivers/cpuidle/cpuidle.c
===================================================================
--- linux-pm.orig/drivers/cpuidle/cpuidle.c
+++ linux-pm/drivers/cpuidle/cpuidle.c
@@ -79,9 +79,9 @@ static int find_deepest_state(struct cpu
bool freeze)
{
unsigned int latency_req = 0;
- int i, ret = -ENXIO;
+ int i, ret = 0;
- for (i = 0; i < drv->state_count; i++) {
+ for (i = 1; i < drv->state_count; i++) {
struct cpuidle_state *s = &drv->states[i];
struct cpuidle_state_usage *su = &dev->states_usage[i];
@@ -243,7 +243,7 @@ int cpuidle_enter_state(struct cpuidle_d
* @drv: the cpuidle driver
* @dev: the cpuidle device
*
- * Returns the index of the idle state.
+ * Returns the index of the idle state. The return value must not be negative.
*/
int cpuidle_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
{
Index: linux-pm/kernel/sched/idle.c
===================================================================
--- linux-pm.orig/kernel/sched/idle.c
+++ linux-pm/kernel/sched/idle.c
@@ -97,12 +97,6 @@ void default_idle_call(void)
static int call_cpuidle(struct cpuidle_driver *drv, struct cpuidle_device *dev,
int next_state)
{
- /* Fall back to the default arch idle method on errors. */
- if (next_state < 0) {
- default_idle_call();
- return next_state;
- }
-
/*
* The idle task must be scheduled, it is pointless to go to idle, just
* update no idle residency and return.
next prev parent reply other threads:[~2016-01-15 23:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-15 23:53 [PATCH 0/2] cpuidle optimizations (on top of linux-next) Rafael J. Wysocki
2016-01-15 23:54 ` Rafael J. Wysocki [this message]
2016-01-18 14:36 ` [PATCH 1/2] sched / idle: Drop default_idle_call() fallback from call_cpuidle() Peter Zijlstra
2016-01-15 23:56 ` [PATCH 2/2] cpuidle: menu: Avoid pointless checks in menu_select() Rafael J. Wysocki
2016-01-18 22:51 ` [Resend][PATCH " Rafael J. Wysocki
2016-01-18 13:45 ` [PATCH 0/2] cpuidle optimizations (on top of linux-next) Sudeep Holla
2016-01-19 7:28 ` Ingo Molnar
2016-01-19 13:14 ` Rafael J. Wysocki
2016-01-19 13:28 ` Ingo Molnar
2016-01-19 13:50 ` 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=2393290.LAksQzHH19@vostro.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=sudeep.holla@arm.com \
/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®