diff options
Diffstat (limited to 'include/linux/vtime.h')
-rw-r--r-- | include/linux/vtime.h | 59 |
1 files changed, 40 insertions, 19 deletions
diff --git a/include/linux/vtime.h b/include/linux/vtime.h index ae30ab58431a..71a5782d8c59 100644 --- a/include/linux/vtime.h +++ b/include/linux/vtime.h | |||
@@ -6,15 +6,46 @@ struct task_struct; | |||
6 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | 6 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING |
7 | extern void vtime_task_switch(struct task_struct *prev); | 7 | extern void vtime_task_switch(struct task_struct *prev); |
8 | extern void vtime_account_system(struct task_struct *tsk); | 8 | extern void vtime_account_system(struct task_struct *tsk); |
9 | extern void vtime_account_system_irqsafe(struct task_struct *tsk); | ||
10 | extern void vtime_account_idle(struct task_struct *tsk); | 9 | extern void vtime_account_idle(struct task_struct *tsk); |
11 | extern void vtime_account_user(struct task_struct *tsk); | 10 | extern void vtime_account_user(struct task_struct *tsk); |
12 | extern void vtime_account(struct task_struct *tsk); | 11 | extern void vtime_account_irq_enter(struct task_struct *tsk); |
13 | #else | 12 | |
13 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE | ||
14 | static inline bool vtime_accounting_enabled(void) { return true; } | ||
15 | #endif | ||
16 | |||
17 | #else /* !CONFIG_VIRT_CPU_ACCOUNTING */ | ||
18 | |||
14 | static inline void vtime_task_switch(struct task_struct *prev) { } | 19 | static inline void vtime_task_switch(struct task_struct *prev) { } |
15 | static inline void vtime_account_system(struct task_struct *tsk) { } | 20 | static inline void vtime_account_system(struct task_struct *tsk) { } |
16 | static inline void vtime_account_system_irqsafe(struct task_struct *tsk) { } | 21 | static inline void vtime_account_user(struct task_struct *tsk) { } |
17 | static inline void vtime_account(struct task_struct *tsk) { } | 22 | static inline void vtime_account_irq_enter(struct task_struct *tsk) { } |
23 | static inline bool vtime_accounting_enabled(void) { return false; } | ||
24 | #endif | ||
25 | |||
26 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN | ||
27 | extern void arch_vtime_task_switch(struct task_struct *tsk); | ||
28 | extern void vtime_account_irq_exit(struct task_struct *tsk); | ||
29 | extern bool vtime_accounting_enabled(void); | ||
30 | extern void vtime_user_enter(struct task_struct *tsk); | ||
31 | static inline void vtime_user_exit(struct task_struct *tsk) | ||
32 | { | ||
33 | vtime_account_user(tsk); | ||
34 | } | ||
35 | extern void vtime_guest_enter(struct task_struct *tsk); | ||
36 | extern void vtime_guest_exit(struct task_struct *tsk); | ||
37 | extern void vtime_init_idle(struct task_struct *tsk); | ||
38 | #else | ||
39 | static 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 | } | ||
44 | static inline void vtime_user_enter(struct task_struct *tsk) { } | ||
45 | static inline void vtime_user_exit(struct task_struct *tsk) { } | ||
46 | static inline void vtime_guest_enter(struct task_struct *tsk) { } | ||
47 | static inline void vtime_guest_exit(struct task_struct *tsk) { } | ||
48 | static inline void vtime_init_idle(struct task_struct *tsk) { } | ||
18 | #endif | 49 | #endif |
19 | 50 | ||
20 | #ifdef CONFIG_IRQ_TIME_ACCOUNTING | 51 | #ifdef CONFIG_IRQ_TIME_ACCOUNTING |
@@ -23,25 +54,15 @@ extern void irqtime_account_irq(struct task_struct *tsk); | |||
23 | static inline void irqtime_account_irq(struct task_struct *tsk) { } | 54 | static inline void irqtime_account_irq(struct task_struct *tsk) { } |
24 | #endif | 55 | #endif |
25 | 56 | ||
26 | static inline void vtime_account_irq_enter(struct task_struct *tsk) | 57 | static inline void account_irq_enter_time(struct task_struct *tsk) |
27 | { | 58 | { |
28 | /* | 59 | vtime_account_irq_enter(tsk); |
29 | * Hardirq can interrupt idle task anytime. So we need vtime_account() | ||
30 | * that performs the idle check in CONFIG_VIRT_CPU_ACCOUNTING. | ||
31 | * Softirq can also interrupt idle task directly if it calls | ||
32 | * local_bh_enable(). Such case probably don't exist but we never know. | ||
33 | * Ksoftirqd is not concerned because idle time is flushed on context | ||
34 | * switch. Softirqs in the end of hardirqs are also not a problem because | ||
35 | * the idle time is flushed on hardirq time already. | ||
36 | */ | ||
37 | vtime_account(tsk); | ||
38 | irqtime_account_irq(tsk); | 60 | irqtime_account_irq(tsk); |
39 | } | 61 | } |
40 | 62 | ||
41 | static inline void vtime_account_irq_exit(struct task_struct *tsk) | 63 | static inline void account_irq_exit_time(struct task_struct *tsk) |
42 | { | 64 | { |
43 | /* On hard|softirq exit we always account to hard|softirq cputime */ | 65 | vtime_account_irq_exit(tsk); |
44 | vtime_account_system(tsk); | ||
45 | irqtime_account_irq(tsk); | 66 | irqtime_account_irq(tsk); |
46 | } | 67 | } |
47 | 68 | ||