mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cpuidle: governor: menu: move repeated correction factor check to init
@ 2014-04-10 13:43 Chander Kashyap
  2014-04-10 14:27 ` Tuukka Tikkanen
  0 siblings, 1 reply; 11+ messages in thread
From: Chander Kashyap @ 2014-04-10 13:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: rafael.j.wysocki, tuukka.tikkanen, daniel.lezcano, Chander Kashyap

In menu_select function we check for correction factor every time.
If it is zero we are initializing to unity. Hence move it to init function
and initialise by unity, hence avoid repeated comparisons.

Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org>
---
 drivers/cpuidle/governors/menu.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index cf7f2f0..048f6d9 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -315,13 +315,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
 	multiplier = performance_multiplier();
 
 	/*
-	 * if the correction factor is 0 (eg first time init or cpu hotplug
-	 * etc), we actually want to start out with a unity factor.
-	 */
-	if (data->correction_factor[data->bucket] == 0)
-		data->correction_factor[data->bucket] = RESOLUTION * DECAY;
-
-	/*
 	 * Force the result of multiplication to be 64 bits even if both
 	 * operands are 32 bits.
 	 * Make sure to round up for half microseconds.
@@ -453,9 +446,17 @@ static int menu_enable_device(struct cpuidle_driver *drv,
 				struct cpuidle_device *dev)
 {
 	struct menu_device *data = &per_cpu(menu_devices, dev->cpu);
+	int i;
 
 	memset(data, 0, sizeof(struct menu_device));
 
+	/*
+	 * if the correction factor is 0 (eg first time init or cpu hotplug
+	 * etc), we actually want to start out with a unity factor.
+	 */
+	for(i = 0; i < BUCKETS; i++)
+		data->correction_factor[i] = RESOLUTION * DECAY;
+
 	return 0;
 }
 
-- 
1.7.9.5


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

end of thread, other threads:[~2014-05-16  9:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-10 13:43 [PATCH] cpuidle: governor: menu: move repeated correction factor check to init Chander Kashyap
2014-04-10 14:27 ` Tuukka Tikkanen
2014-04-22  2:57   ` Chander Kashyap
2014-04-22 10:03     ` Rafael J. Wysocki
2014-04-22  9:54       ` Chander Kashyap
2014-04-22 11:24         ` Rafael J. Wysocki
2014-04-22 12:26           ` Chander Kashyap
2014-04-22 12:38             ` [RESEND][PATCH] " Chander Kashyap
2014-05-16  8:16               ` Chander Kashyap
2014-05-16  9:46                 ` Rafael J. Wysocki
2014-05-16  9:54                   ` Chander Kashyap

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®