From: Viresh Kumar Date: Thu, 16 May 2013 08:52:49 +0000 (+0530) Subject: cpufreq: interactive: Use generic get_cpu_idle_time() from cpufreq.c X-Git-Tag: firefly_0821_release~2958^2~255 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0be8516aaa8e1367beb1a401f8a4ed559f8b15b4;p=firefly-linux-kernel-4.4.55.git cpufreq: interactive: Use generic get_cpu_idle_time() from cpufreq.c Now that a generic version of get_cpu_idle_time() is available, use that for the interactive governor. [toddpoynor@google.com: commit text changes] Change-Id: Ia38b57085aac99ec3d415fe44471d5dfde519c2c Signed-off-by: Viresh Kumar Signed-off-by: Jon Medhurst Signed-off-by: John Stultz --- diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c index 8297ac69863b..ff77b300df88 100644 --- a/drivers/cpufreq/cpufreq_interactive.c +++ b/drivers/cpufreq/cpufreq_interactive.c @@ -30,8 +30,6 @@ #include #include #include -#include -#include #define CREATE_TRACE_POINTS #include @@ -119,44 +117,6 @@ struct cpufreq_interactive_tunables *common_tunables; static struct attribute_group *get_sysfs_attr(void); -static inline cputime64_t get_cpu_idle_time_jiffy(unsigned int cpu, - cputime64_t *wall) -{ - u64 idle_time; - u64 cur_wall_time; - u64 busy_time; - - cur_wall_time = jiffies64_to_cputime64(get_jiffies_64()); - - busy_time = kcpustat_cpu(cpu).cpustat[CPUTIME_USER]; - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_SYSTEM]; - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_IRQ]; - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_SOFTIRQ]; - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_STEAL]; - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_NICE]; - - idle_time = cur_wall_time - busy_time; - if (wall) - *wall = jiffies_to_usecs(cur_wall_time); - - return jiffies_to_usecs(idle_time); -} - -static inline cputime64_t get_cpu_idle_time( - unsigned int cpu, - cputime64_t *wall, - bool io_is_busy) -{ - u64 idle_time = get_cpu_idle_time_us(cpu, wall); - - if (idle_time == -1ULL) - idle_time = get_cpu_idle_time_jiffy(cpu, wall); - else if (!io_is_busy) - idle_time += get_cpu_iowait_time_us(cpu, wall); - - return idle_time; -} - static void cpufreq_interactive_timer_resched( struct cpufreq_interactive_cpuinfo *pcpu) {