aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-11 11:49:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-11 11:49:34 -0400
commit098ef215b1e87cff51f983bae4e4e1358b932ec9 (patch)
tree2f906ac44e65ce463bbdfa7291773c012663b2c8 /kernel
parentb922df7383749a1c0b7ea64c50fa839263d3816b (diff)
parent4f6e6b9f97b0ce98a8d1da65adbaf743bd0486a9 (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq
* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq: [CPUFREQ] Fix BUG: using smp_processor_id() in preemptible code [CPUFREQ] Don't export governors for default governor [CPUFREQ][6/6] cpufreq: Add idle microaccounting in ondemand governor [CPUFREQ][5/6] cpufreq: Changes to get_cpu_idle_time_us(), used by ondemand governor [CPUFREQ][4/6] cpufreq_ondemand: Parameterize down differential [CPUFREQ][3/6] cpufreq: get_cpu_idle_time() changes in ondemand for idle-microaccounting [CPUFREQ][2/6] cpufreq: Change load calculation in ondemand for software coordination [CPUFREQ][1/6] cpufreq: Add cpu number parameter to __cpufreq_driver_getavg() [CPUFREQ] use deferrable delayed work init in conservative governor [CPUFREQ] drivers/cpufreq/cpufreq.c: Adjust error handling code involving cpufreq_cpu_put [CPUFREQ] add error handling for cpufreq_register_governor() error [CPUFREQ] acpi-cpufreq: add error handling for cpufreq_register_driver() error [CPUFREQ] Coding style fixes to arch/x86/kernel/cpu/cpufreq/powernow-k6.c [CPUFREQ] Coding style fixes to arch/x86/kernel/cpu/cpufreq/elanfreq.c
Diffstat (limited to 'kernel')
-rw-r--r--kernel/time/tick-sched.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index cb02324bdb88..a4d219398167 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -20,6 +20,7 @@
20#include <linux/profile.h> 20#include <linux/profile.h>
21#include <linux/sched.h> 21#include <linux/sched.h>
22#include <linux/tick.h> 22#include <linux/tick.h>
23#include <linux/module.h>
23 24
24#include <asm/irq_regs.h> 25#include <asm/irq_regs.h>
25 26
@@ -190,9 +191,17 @@ u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time)
190{ 191{
191 struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu); 192 struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
192 193
193 *last_update_time = ktime_to_us(ts->idle_lastupdate); 194 if (!tick_nohz_enabled)
195 return -1;
196
197 if (ts->idle_active)
198 *last_update_time = ktime_to_us(ts->idle_lastupdate);
199 else
200 *last_update_time = ktime_to_us(ktime_get());
201
194 return ktime_to_us(ts->idle_sleeptime); 202 return ktime_to_us(ts->idle_sleeptime);
195} 203}
204EXPORT_SYMBOL_GPL(get_cpu_idle_time_us);
196 205
197/** 206/**
198 * tick_nohz_stop_sched_tick - stop the idle tick from the idle task 207 * tick_nohz_stop_sched_tick - stop the idle tick from the idle task