[PATCH v1 05/19] sched: update this_cpu_load() to return u64 value
From: Nikhil Rao
Date: Sun May 01 2011 - 21:20:14 EST
The idlecpu governor uses this_cpu_load() for calculations which is now returns
u64. Update idlecpu governor to also use u64.
Signed-off-by: Nikhil Rao <ncrao@xxxxxxxxxx>
---
drivers/cpuidle/governors/menu.c | 5 ++---
include/linux/sched.h | 2 +-
kernel/sched.c | 2 +-
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index f508690..2051134 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -127,10 +127,9 @@ struct menu_device {
static int get_loadavg(void)
{
- unsigned long this = this_cpu_load();
+ u64 this = this_cpu_load();
-
- return LOAD_INT(this) * 10 + LOAD_FRAC(this) / 10;
+ return div_u64(LOAD_INT(this) * 10 + LOAD_FRAC(this), 10);
}
static inline int which_bucket(unsigned int duration)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 6d88be1..546a418 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -140,7 +140,7 @@ extern unsigned long nr_running(void);
extern unsigned long nr_uninterruptible(void);
extern unsigned long nr_iowait(void);
extern unsigned long nr_iowait_cpu(int cpu);
-extern unsigned long this_cpu_load(void);
+extern u64 this_cpu_load(void);
extern void calc_global_load(unsigned long ticks);
diff --git a/kernel/sched.c b/kernel/sched.c
index 7badde6..f2eb816 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3061,7 +3061,7 @@ unsigned long nr_iowait_cpu(int cpu)
return atomic_read(&this->nr_iowait);
}
-unsigned long this_cpu_load(void)
+u64 this_cpu_load(void)
{
struct rq *this = this_rq();
return this->cpu_load[0];
--
1.7.3.1
--
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/