diff options
| author | Eric Paris <eparis@redhat.com> | 2013-11-22 18:57:08 -0500 |
|---|---|---|
| committer | Eric Paris <eparis@redhat.com> | 2013-11-22 18:57:54 -0500 |
| commit | fc582aef7dcc27a7120cf232c1e76c569c7b6eab (patch) | |
| tree | 7d275dd4ceab6067b91e9a25a5f6338b425fbccd /include/linux/vtime.h | |
| parent | 9175c9d2aed528800175ef81c90569d00d23f9be (diff) | |
| parent | 5e01dc7b26d9f24f39abace5da98ccbd6a5ceb52 (diff) | |
Merge tag 'v3.12'
Linux 3.12
Conflicts:
fs/exec.c
Diffstat (limited to 'include/linux/vtime.h')
| -rw-r--r-- | include/linux/vtime.h | 74 |
1 files changed, 65 insertions, 9 deletions
diff --git a/include/linux/vtime.h b/include/linux/vtime.h index b1dd2db80076..f5b72b364bda 100644 --- a/include/linux/vtime.h +++ b/include/linux/vtime.h | |||
| @@ -1,18 +1,68 @@ | |||
| 1 | #ifndef _LINUX_KERNEL_VTIME_H | 1 | #ifndef _LINUX_KERNEL_VTIME_H |
| 2 | #define _LINUX_KERNEL_VTIME_H | 2 | #define _LINUX_KERNEL_VTIME_H |
| 3 | 3 | ||
| 4 | #include <linux/context_tracking_state.h> | ||
| 5 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE | ||
| 6 | #include <asm/vtime.h> | ||
| 7 | #endif | ||
| 8 | |||
| 9 | |||
| 4 | struct task_struct; | 10 | struct task_struct; |
| 5 | 11 | ||
| 12 | /* | ||
| 13 | * vtime_accounting_enabled() definitions/declarations | ||
| 14 | */ | ||
| 15 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE | ||
| 16 | static inline bool vtime_accounting_enabled(void) { return true; } | ||
| 17 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ | ||
| 18 | |||
| 19 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN | ||
| 20 | static inline bool vtime_accounting_enabled(void) | ||
| 21 | { | ||
| 22 | if (static_key_false(&context_tracking_enabled)) { | ||
| 23 | if (context_tracking_active()) | ||
| 24 | return true; | ||
| 25 | } | ||
| 26 | |||
| 27 | return false; | ||
| 28 | } | ||
| 29 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING_GEN */ | ||
| 30 | |||
| 31 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING | ||
| 32 | static inline bool vtime_accounting_enabled(void) { return false; } | ||
| 33 | #endif /* !CONFIG_VIRT_CPU_ACCOUNTING */ | ||
| 34 | |||
| 35 | |||
| 36 | /* | ||
| 37 | * Common vtime APIs | ||
| 38 | */ | ||
| 6 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | 39 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING |
| 40 | |||
| 41 | #ifdef __ARCH_HAS_VTIME_TASK_SWITCH | ||
| 7 | extern void vtime_task_switch(struct task_struct *prev); | 42 | extern void vtime_task_switch(struct task_struct *prev); |
| 43 | #else | ||
| 44 | extern void vtime_common_task_switch(struct task_struct *prev); | ||
| 45 | static inline void vtime_task_switch(struct task_struct *prev) | ||
| 46 | { | ||
| 47 | if (vtime_accounting_enabled()) | ||
| 48 | vtime_common_task_switch(prev); | ||
| 49 | } | ||
| 50 | #endif /* __ARCH_HAS_VTIME_TASK_SWITCH */ | ||
| 51 | |||
| 8 | extern void vtime_account_system(struct task_struct *tsk); | 52 | extern void vtime_account_system(struct task_struct *tsk); |
| 9 | extern void vtime_account_idle(struct task_struct *tsk); | 53 | extern void vtime_account_idle(struct task_struct *tsk); |
| 10 | extern void vtime_account_user(struct task_struct *tsk); | 54 | extern void vtime_account_user(struct task_struct *tsk); |
| 11 | extern void vtime_account_irq_enter(struct task_struct *tsk); | ||
| 12 | 55 | ||
| 13 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE | 56 | #ifdef __ARCH_HAS_VTIME_ACCOUNT |
| 14 | static inline bool vtime_accounting_enabled(void) { return true; } | 57 | extern void vtime_account_irq_enter(struct task_struct *tsk); |
| 15 | #endif | 58 | #else |
| 59 | extern void vtime_common_account_irq_enter(struct task_struct *tsk); | ||
| 60 | static inline void vtime_account_irq_enter(struct task_struct *tsk) | ||
| 61 | { | ||
| 62 | if (vtime_accounting_enabled()) | ||
| 63 | vtime_common_account_irq_enter(tsk); | ||
| 64 | } | ||
| 65 | #endif /* __ARCH_HAS_VTIME_ACCOUNT */ | ||
| 16 | 66 | ||
| 17 | #else /* !CONFIG_VIRT_CPU_ACCOUNTING */ | 67 | #else /* !CONFIG_VIRT_CPU_ACCOUNTING */ |
| 18 | 68 | ||
| @@ -20,14 +70,20 @@ static inline void vtime_task_switch(struct task_struct *prev) { } | |||
| 20 | static inline void vtime_account_system(struct task_struct *tsk) { } | 70 | static inline void vtime_account_system(struct task_struct *tsk) { } |
| 21 | static inline void vtime_account_user(struct task_struct *tsk) { } | 71 | static inline void vtime_account_user(struct task_struct *tsk) { } |
| 22 | static inline void vtime_account_irq_enter(struct task_struct *tsk) { } | 72 | static inline void vtime_account_irq_enter(struct task_struct *tsk) { } |
| 23 | static inline bool vtime_accounting_enabled(void) { return false; } | 73 | #endif /* !CONFIG_VIRT_CPU_ACCOUNTING */ |
| 24 | #endif | ||
| 25 | 74 | ||
| 26 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN | 75 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN |
| 27 | extern void arch_vtime_task_switch(struct task_struct *tsk); | 76 | extern void arch_vtime_task_switch(struct task_struct *tsk); |
| 28 | extern void vtime_account_irq_exit(struct task_struct *tsk); | 77 | extern void vtime_gen_account_irq_exit(struct task_struct *tsk); |
| 29 | extern bool vtime_accounting_enabled(void); | 78 | |
| 79 | static inline void vtime_account_irq_exit(struct task_struct *tsk) | ||
| 80 | { | ||
| 81 | if (vtime_accounting_enabled()) | ||
| 82 | vtime_gen_account_irq_exit(tsk); | ||
| 83 | } | ||
| 84 | |||
| 30 | extern void vtime_user_enter(struct task_struct *tsk); | 85 | extern void vtime_user_enter(struct task_struct *tsk); |
| 86 | |||
| 31 | static inline void vtime_user_exit(struct task_struct *tsk) | 87 | static inline void vtime_user_exit(struct task_struct *tsk) |
| 32 | { | 88 | { |
| 33 | vtime_account_user(tsk); | 89 | vtime_account_user(tsk); |
| @@ -35,7 +91,7 @@ static inline void vtime_user_exit(struct task_struct *tsk) | |||
| 35 | extern void vtime_guest_enter(struct task_struct *tsk); | 91 | extern void vtime_guest_enter(struct task_struct *tsk); |
| 36 | extern void vtime_guest_exit(struct task_struct *tsk); | 92 | extern void vtime_guest_exit(struct task_struct *tsk); |
| 37 | extern void vtime_init_idle(struct task_struct *tsk, int cpu); | 93 | extern void vtime_init_idle(struct task_struct *tsk, int cpu); |
| 38 | #else | 94 | #else /* !CONFIG_VIRT_CPU_ACCOUNTING_GEN */ |
| 39 | static inline void vtime_account_irq_exit(struct task_struct *tsk) | 95 | static inline void vtime_account_irq_exit(struct task_struct *tsk) |
| 40 | { | 96 | { |
| 41 | /* On hard|softirq exit we always account to hard|softirq cputime */ | 97 | /* On hard|softirq exit we always account to hard|softirq cputime */ |
