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 2/2] cpuidle: menu: Avoid pointless checks in menu_select()
Date: Sat, 16 Jan 2016 00:56:34 +0100 [thread overview]
Message-ID: <7876665.vgkxSAt2aO@vostro.rjw.lan> (raw)
In-Reply-To: <1621492.NI2xz9vt7M@vostro.rjw.lan>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Subject: [PATCH]
If menu_select() cannot find a suitable state to return, it will
return the state index stored in data->last_state_idx. This
means that it is pointless to look at the states whose indices
are less than or equal to data->last_state_idx in the main loop,
so don't do that.
Given that those checks are done on every idle state selection, this
change can save quite a bit of completely unnecessary overhead.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/cpuidle/governors/menu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-pm/drivers/cpuidle/governors/menu.c
===================================================================
--- linux-pm.orig/drivers/cpuidle/governors/menu.c
+++ linux-pm/drivers/cpuidle/governors/menu.c
@@ -342,7 +342,7 @@ static int menu_select(struct cpuidle_dr
* Find the idle state with the lowest power while satisfying
* our constraints.
*/
- for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) {
+ for (i = data->last_state_idx + 1; i < drv->state_count; i++) {
struct cpuidle_state *s = &drv->states[i];
struct cpuidle_state_usage *su = &dev->states_usage[i];
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 ` [PATCH 1/2] sched / idle: Drop default_idle_call() fallback from call_cpuidle() Rafael J. Wysocki
2016-01-18 14:36 ` Peter Zijlstra
2016-01-15 23:56 ` Rafael J. Wysocki [this message]
2016-01-18 22:51 ` [Resend][PATCH 2/2] cpuidle: menu: Avoid pointless checks in menu_select() 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=7876665.vgkxSAt2aO@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®