aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2012-07-16 12:00:34 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2013-01-27 13:23:29 -0500
commit3f4724ea85b7d9055a9976fa8f30b471bdfbca93 (patch)
treeaaa1792d0b78ea33c07ee6f5e707a07d9ef1795e /include
parentabf917cd91cbb73952758f9741e2fa65002a48ee (diff)
cputime: Allow dynamic switch between tick/virtual based cputime accounting
Allow to dynamically switch between tick and virtual based cputime accounting. This way we can provide a kind of "on-demand" virtual based cputime accounting. In this mode, the kernel relies on the context tracking subsystem to dynamically probe on kernel boundaries. This is in preparation for being able to stop the timer tick in more places than just the idle state. Doing so will depend on CONFIG_VIRT_CPU_ACCOUNTING_GEN which makes it possible to account the cputime without the tick by hooking on kernel/user boundaries. Depending whether the tick is stopped or not, we can switch between tick and vtime based accounting anytime in order to minimize the overhead associated to user hooks. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Li Zhong <zhong@linux.vnet.ibm.com> Cc: Namhyung Kim <namhyung.kim@lge.com> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/linux/vtime.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/vtime.h b/include/linux/vtime.h
index 21ef703d1b25..5368af9bdf06 100644
--- a/include/linux/vtime.h
+++ b/include/linux/vtime.h
@@ -10,12 +10,20 @@ extern void vtime_account_system_irqsafe(struct task_struct *tsk);
10extern void vtime_account_idle(struct task_struct *tsk); 10extern void vtime_account_idle(struct task_struct *tsk);
11extern void vtime_account_user(struct task_struct *tsk); 11extern void vtime_account_user(struct task_struct *tsk);
12extern void vtime_account(struct task_struct *tsk); 12extern void vtime_account(struct task_struct *tsk);
13
14#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
15extern bool vtime_accounting_enabled(void);
13#else 16#else
17static inline bool vtime_accounting_enabled(void) { return true; }
18#endif
19
20#else /* !CONFIG_VIRT_CPU_ACCOUNTING */
14static inline void vtime_task_switch(struct task_struct *prev) { } 21static inline void vtime_task_switch(struct task_struct *prev) { }
15static inline void vtime_account_system(struct task_struct *tsk) { } 22static inline void vtime_account_system(struct task_struct *tsk) { }
16static inline void vtime_account_system_irqsafe(struct task_struct *tsk) { } 23static inline void vtime_account_system_irqsafe(struct task_struct *tsk) { }
17static inline void vtime_account_user(struct task_struct *tsk) { } 24static inline void vtime_account_user(struct task_struct *tsk) { }
18static inline void vtime_account(struct task_struct *tsk) { } 25static inline void vtime_account(struct task_struct *tsk) { }
26static inline bool vtime_accounting_enabled(void) { return false; }
19#endif 27#endif
20 28
21#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN 29#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN