lkml.org 
[lkml]   [2011]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC][Patch 05/18] sched: update this_cpu_load() to return u64 value
Date
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@google.com>
---
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 94dd1df..175764b 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3062,7 +3062,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


\
 
 \ /
  Last update: 2011-04-20 22:57    [from the cache]
©2003-2011 Jasper Spaans