tcp: take care of truncations done by sk_filter()
[GitHub/mt8127/android_kernel_alcatel_ttab.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);
8extern void vtime_account_system(struct task_struct *tsk);
fd25b4c2 9extern void vtime_account_idle(struct task_struct *tsk);
bcebdf84 10extern void vtime_account_user(struct task_struct *tsk);
6a61671b 11extern void vtime_account_irq_enter(struct task_struct *tsk);
3f4724ea 12
6a61671b 13#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
3f4724ea
FW
14static inline bool vtime_accounting_enabled(void) { return true; }
15#endif
16
17#else /* !CONFIG_VIRT_CPU_ACCOUNTING */
6a61671b 18
dcbf832e 19static inline void vtime_task_switch(struct task_struct *prev) { }
11113334 20static inline void vtime_account_system(struct task_struct *tsk) { }
abf917cd 21static inline void vtime_account_user(struct task_struct *tsk) { }
6a61671b 22static inline void vtime_account_irq_enter(struct task_struct *tsk) { }
3f4724ea 23static inline bool vtime_accounting_enabled(void) { return false; }
abf917cd
FW
24#endif
25
26#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
6a61671b
FW
27extern void arch_vtime_task_switch(struct task_struct *tsk);
28extern void vtime_account_irq_exit(struct task_struct *tsk);
29extern bool vtime_accounting_enabled(void);
30extern void vtime_user_enter(struct task_struct *tsk);
abf917cd
FW
31static inline void vtime_user_exit(struct task_struct *tsk)
32{
33 vtime_account_user(tsk);
34}
6a61671b
FW
35extern void vtime_guest_enter(struct task_struct *tsk);
36extern void vtime_guest_exit(struct task_struct *tsk);
45eacc69 37extern void vtime_init_idle(struct task_struct *tsk, int cpu);
abf917cd 38#else
6a61671b
FW
39static inline void vtime_account_irq_exit(struct task_struct *tsk)
40{
41 /* On hard|softirq exit we always account to hard|softirq cputime */
42 vtime_account_system(tsk);
43}
abf917cd
FW
44static inline void vtime_user_enter(struct task_struct *tsk) { }
45static inline void vtime_user_exit(struct task_struct *tsk) { }
6a61671b
FW
46static inline void vtime_guest_enter(struct task_struct *tsk) { }
47static inline void vtime_guest_exit(struct task_struct *tsk) { }
45eacc69 48static inline void vtime_init_idle(struct task_struct *tsk, int cpu) { }
dcbf832e
FW
49#endif
50
3e1df4f5
FW
51#ifdef CONFIG_IRQ_TIME_ACCOUNTING
52extern void irqtime_account_irq(struct task_struct *tsk);
dcbf832e 53#else
3e1df4f5 54static inline void irqtime_account_irq(struct task_struct *tsk) { }
dcbf832e
FW
55#endif
56
6a61671b 57static inline void account_irq_enter_time(struct task_struct *tsk)
fa5058f3 58{
6a61671b 59 vtime_account_irq_enter(tsk);
3e1df4f5 60 irqtime_account_irq(tsk);
fa5058f3
FW
61}
62
6a61671b 63static inline void account_irq_exit_time(struct task_struct *tsk)
fa5058f3 64{
6a61671b 65 vtime_account_irq_exit(tsk);
3e1df4f5 66 irqtime_account_irq(tsk);
fa5058f3
FW
67}
68
dcbf832e 69#endif /* _LINUX_KERNEL_VTIME_H */