Re: [PATCH] cpufreq: fix conservative/ondemand behaviour with ignore_nice_load

From: Pallipadi, Venkatesh
Date: Tue Nov 10 2009 - 17:20:46 EST


On Tue, Nov 10, 2009 at 11:42:02AM -0800, Pallipadi, Venkatesh wrote:
> >-----Original Message-----
> >From: cpufreq-owner@xxxxxxxxxxxxxxx
> >[mailto:cpufreq-owner@xxxxxxxxxxxxxxx] On Behalf Of Alexander Miller
> >Sent: Friday, November 06, 2009 8:27 AM
> >To: linux-kernel@xxxxxxxxxxxxxxx
> >Cc: cpufreq@xxxxxxxxxxxxxxx; Dave Jones
> >Subject: [PATCH] cpufreq: fix conservative/ondemand behaviour
> >with ignore_nice_load
> >
> >Remove conversion of nice load to microseconds which caused addition
> >of times measured in different units and thus unreasonable behaviour
> >with both governors.
>
> Can you describe the "unresonable behavior" you are seeing. Is it
> with NO_HZ enabled or disabled?
>
> I see there can be a problem with this code when NO_HZ is disabled.
> But, the patch below is not the right solution as it will result in
> Adding times in different units with NO_HZ enabled.
>
> Thanks,
> Venki

Does the below test patch (only compile tested) resolve the problem you
are seeing?

Thanks,
Venki

---
drivers/cpufreq/cpufreq_conservative.c | 4 ++--
drivers/cpufreq/cpufreq_ondemand.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index bc33ddc..c7b081b 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -116,9 +116,9 @@ static inline cputime64_t get_cpu_idle_time_jiffy(unsigned int cpu,

idle_time = cputime64_sub(cur_wall_time, busy_time);
if (wall)
- *wall = cur_wall_time;
+ *wall = (cputime64_t)jiffies_to_usecs(cur_wall_time);

- return idle_time;
+ return (cputime64_t)jiffies_to_usecs(idle_time);;
}

static inline cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall)
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 071699d..4b34ade 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -133,9 +133,9 @@ static inline cputime64_t get_cpu_idle_time_jiffy(unsigned int cpu,

idle_time = cputime64_sub(cur_wall_time, busy_time);
if (wall)
- *wall = cur_wall_time;
+ *wall = (cputime64_t)jiffies_to_usecs(cur_wall_time);

- return idle_time;
+ return (cputime64_t)jiffies_to_usecs(idle_time);
}

static inline cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall)
--
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/