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 <viresh.kumar@linaro.org> Signed-off-by: Jon Medhurst <tixy@linaro.org> Signed-off-by: John Stultz <john.stultz@linaro.org>
This commit is contained in:
committed by
John Stultz
parent
8385286d76
commit
0be8516aaa
@@ -30,8 +30,6 @@
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/kernel_stat.h>
|
||||
#include <asm/cputime.h>
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include <trace/events/cpufreq_interactive.h>
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user