Re: [PATCH] cpuidle: governor: menu: move repeated correction factor check to init

2014-04-10 Thread Tuukka Tikkanen
* 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 > Reviewed-by: Tuukka Tikkanen

Re: [PATCH 6/7] Cpuidle: Deal with timer expiring in the past

2014-03-10 Thread Tuukka Tikkanen
Hi, On 6 March 2014 09:41, Len Brown wrote: > > On Mon, Feb 24, 2014 at 1:29 AM, Tuukka Tikkanen > wrote: > > Sometimes (fairly often) when the cpuidle menu governor is making a decision > > about idle state to enter the next timer for the cpu appears to expire in &

Re: [PATCH 7/7] Cpuidle: poll state can measure residency

2014-02-25 Thread Tuukka Tikkanen
On 25 February 2014 12:56, Daniel Lezcano wrote: > On 02/24/2014 07:29 AM, Tuukka Tikkanen wrote: >> >> For some platforms, a poll state is inserted in the cpuidle driver states. >> The flags for the state do not indicate that timekeeping is not affected. >> As the

[PATCH 7/7] Cpuidle: poll state can measure residency

2014-02-24 Thread Tuukka Tikkanen
-off-by: Tuukka Tikkanen --- drivers/cpuidle/driver.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c index 06dbe7c..136d6a2 100644 --- a/drivers/cpuidle/driver.c +++ b/drivers/cpuidle/driver.c @@ -209,7 +209,7 @@ static

[PATCH 3/7] Cpuidle: Ensure menu coefficients stay within domain

2014-02-24 Thread Tuukka Tikkanen
coefficients are updated with measured idle durations exceeding timer length, the multiplier may reach values exceeding unity (i.e. the stored numerator exceeds RESOLUTION*DECAY). This patch ensures that the multipliers are updated with durations capped to timer length. Signed-off-by: Tuukka Tikkanen

[PATCH 0/7] Cpuidle: Minor fixes

2014-02-24 Thread Tuukka Tikkanen
all will eventually return to the framework. The redundant time measurement could be removed, unless there is some obscure way of getting called on some platform that I am unable to figure out.) Tuukka Tikkanen (7): Cpuidle: rename expected_us to next_timer_us in menu governor Cpuidle: Use actual state

[PATCH 5/7] Cpuidle: Move perf multiplier calculation out of the selection loop

2014-02-24 Thread Tuukka Tikkanen
n, the minor performance hit allows making a generic sleep state selection function based on (sleep duration, maximum latency) tuple. Signed-off-by: Tuukka Tikkanen --- drivers/cpuidle/governors/menu.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/driver

[PATCH 2/7] Cpuidle: Use actual state latency in menu governor

2014-02-23 Thread Tuukka Tikkanen
entered state information is available, so we can use that to obtain the real exit latency. Signed-off-by: Tuukka Tikkanen --- drivers/cpuidle/governors/menu.c |7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors

[PATCH 1/7] Cpuidle: rename expected_us to next_timer_us in menu governor

2014-02-23 Thread Tuukka Tikkanen
wakeup source being active. This patch renames expected_us to next_timer_us in order to better reflect the contained information. Signed-off-by: Tuukka Tikkanen --- drivers/cpuidle/governors/menu.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers

[PATCH 4/7] Cpuidle: Do not substract exit latency from assumed sleep length

2014-02-23 Thread Tuukka Tikkanen
clarifies the associated comment. It also removes one intermediate variable that serves no purpose. Signed-off-by: Tuukka Tikkanen --- drivers/cpuidle/governors/menu.c | 44 ++ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/drivers/cpuidle

[PATCH 6/7] Cpuidle: Deal with timer expiring in the past

2014-02-23 Thread Tuukka Tikkanen
see if the state 0 has been disabled or not. Signed-off-by: Tuukka Tikkanen --- drivers/cpuidle/governors/menu.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index 71b5232..c414468 100644 --- a

[PATCH 6/8] Cpuidle: Fix variable domains in get_typical_interval()

2013-08-14 Thread tuukka . tikkanen
From: Tuukka Tikkanen The menu governor uses a static function get_typical_interval() to try to detect a repeating pattern of wakeups. The previous interval durations are stored as an array of unsigned ints, but the arithmetic in the function is performed exclusively as 64 bit values, even when

[PATCH 8/8] Cpuidle: Change struct menu_device field types

2013-08-14 Thread tuukka . tikkanen
From: Tuukka Tikkanen Field predicted_us value can never exceed expected_us value, but it has a potentially larger type. As there is no need for additional 32 bits of zeroes on 32 bit plaforms, change the type of predicted_us to match the type of expected_us. Field correction_factor is used to

[PATCH 5/8] Cpuidle: Fix menu_device->intervals type

2013-08-14 Thread tuukka . tikkanen
From: Tuukka Tikkanen Struct menu_device member intervals is declared as u32, but the value stored is (unsigned) int. The type is changed to match the value being stored. Signed-off-by: Tuukka Tikkanen --- drivers/cpuidle/governors/menu.c |2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH 4/8] Cpuidle: CodingStyle: Break up multiple assignments on single line

2013-08-14 Thread tuukka . tikkanen
From: Tuukka Tikkanen The function get_typical_interval() initializes a number of variables that are immediately after declarations assigned constant values. In addition, there are multiple assignments on a single line, which is explicitly forbidden by Documentation/CodingStyle. This patch

[PATCH 0/8] Cpuidle: Menu governor fixes

2013-08-14 Thread tuukka . tikkanen
From: Tuukka Tikkanen This series of patches fixes some bugs, style issues and wild use of variable types in cpuidle menu governor. One of the bugs is a logic flaw where a detected previously recurring pattern is given priority over known guaranteed earlier wakeup. The others involve value

[PATCH 1/8] Cpuidle: Ignore interval prediction result when timer is shorter

2013-08-14 Thread tuukka . tikkanen
From: Tuukka Tikkanen This patch prevents cpuidle menu governor from using repeating interval prediction result if the idle period predicted is longer than the one allowed by shortest running timer. Signed-off-by: Tuukka Tikkanen --- drivers/cpuidle/governors/menu.c |5 - 1 file

[PATCH 2/8] Cpuidle: Rearrange code and comments in get_typical_interval()

2013-08-14 Thread tuukka . tikkanen
From: Tuukka Tikkanen This patch rearranges a if-return-elsif-goto-fi-return sequence into if-return-fi-if-return-fi-goto sequence. The functionality remains the same. Also, a lengthy comment that did not describe the functionality in the order it occurs is split into half and top half is moved

[PATCH 3/8] Cpuidle: Check called function parameter in get_typical_interval()

2013-08-14 Thread tuukka . tikkanen
From: Tuukka Tikkanen get_typical_interval() uses int_sqrt() in calculation of standard deviation. The formal parameter of int_sqrt() is unsigned long, which may on some platforms be smaller than the 64 bit unsigned integer used as the actual parameter. The overflow can occur frequently when

[PATCH 7/8] Cpuidle: Add a comment warning about possible overflow

2013-08-14 Thread tuukka . tikkanen
From: Tuukka Tikkanen The menu governor has a number of tunable constants that may be changed in the source. If certain combination of values are chosen, an overflow is possible when the correction_factor is being recalculated. This patch adds a warning regarding this possibility and describes