Merge tag 'cputime-cleanups-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel...
[deliverable/linux.git] / include / linux / vtime.h
CommitLineData
dcbf832e
FW
1#ifndef _LINUX_KERNEL_VTIME_H
2#define _LINUX_KERNEL_VTIME_H
3
4struct task_struct;
5
6#ifdef CONFIG_VIRT_CPU_ACCOUNTING
7extern void vtime_task_switch(struct task_struct *prev);
11113334 8extern void __vtime_account_system(struct task_struct *tsk);
dcbf832e 9extern void vtime_account_system(struct task_struct *tsk);
11113334 10extern void __vtime_account_idle(struct task_struct *tsk);
3e1df4f5 11extern void vtime_account(struct task_struct *tsk);
dcbf832e
FW
12#else
13static inline void vtime_task_switch(struct task_struct *prev) { }
3e1df4f5 14static inline void __vtime_account_system(struct task_struct *tsk) { }
11113334 15static inline void vtime_account_system(struct task_struct *tsk) { }
3e1df4f5 16static inline void vtime_account(struct task_struct *tsk) { }
dcbf832e
FW
17#endif
18
3e1df4f5
FW
19#ifdef CONFIG_IRQ_TIME_ACCOUNTING
20extern void irqtime_account_irq(struct task_struct *tsk);
dcbf832e 21#else
3e1df4f5 22static inline void irqtime_account_irq(struct task_struct *tsk) { }
dcbf832e
FW
23#endif
24
fa5058f3
FW
25static inline void vtime_account_irq_enter(struct task_struct *tsk)
26{
27 /*
28 * Hardirq can interrupt idle task anytime. So we need vtime_account()
29 * that performs the idle check in CONFIG_VIRT_CPU_ACCOUNTING.
30 * Softirq can also interrupt idle task directly if it calls
31 * local_bh_enable(). Such case probably don't exist but we never know.
32 * Ksoftirqd is not concerned because idle time is flushed on context
33 * switch. Softirqs in the end of hardirqs are also not a problem because
34 * the idle time is flushed on hardirq time already.
35 */
36 vtime_account(tsk);
3e1df4f5 37 irqtime_account_irq(tsk);
fa5058f3
FW
38}
39
40static inline void vtime_account_irq_exit(struct task_struct *tsk)
41{
fa5058f3
FW
42 /* On hard|softirq exit we always account to hard|softirq cputime */
43 __vtime_account_system(tsk);
3e1df4f5 44 irqtime_account_irq(tsk);
fa5058f3
FW
45}
46
dcbf832e 47#endif /* _LINUX_KERNEL_VTIME_H */
This page took 0.026972 seconds and 5 git commands to generate.