linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] cpuidle: reduce unnecessary loop in c-state selection
@ 2014-01-16 12:45 Alex Shi
  2014-01-16 15:53 ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Alex Shi @ 2014-01-16 12:45 UTC (permalink / raw)
  To: rjw, daniel.lezcano; +Cc: linux-pm, Alex Shi

All deeper c-state have the longer target_residency and exit_latency
So, if the one can not meet our prediction, neither any later.
So, just break out the for loop to save few checking instructions.

Signed-off-by: Alex Shi <alex.shi@linaro.org>
---
 drivers/cpuidle/governors/menu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index cf7f2f0..48ed3fb 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -352,11 +352,11 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
 		if (s->disabled || su->disable)
 			continue;
 		if (s->target_residency > data->predicted_us)
-			continue;
+			break;
 		if (s->exit_latency > latency_req)
-			continue;
+			break;
 		if (s->exit_latency * multiplier > data->predicted_us)
-			continue;
+			break;
 
 		data->last_state_idx = i;
 		data->exit_us = s->exit_latency;
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-22  8:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-16 12:45 [RFC PATCH] cpuidle: reduce unnecessary loop in c-state selection Alex Shi
2014-01-16 15:53 ` Rafael J. Wysocki
2014-01-22  7:53   ` Alex Shi
2014-01-22  8:19     ` Daniel Lezcano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).