diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2016-07-13 10:50:04 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-07-14 04:42:35 -0400 |
commit | 8612f17ab99c1f0770792bc875f5f039212a2a85 (patch) | |
tree | 49092de1107eb26d4947d05906ed36d645a358ec | |
parent | 0cfdf9a198b0d4f5ad6c87d894db7830b796b2cc (diff) |
sched/cputime: Reorganize vtime native irqtime accounting headers
The vtime irqtime accounting headers are very scattered and convoluted
right now. Reorganize them such that it is obvious that only
CONFIG_VIRT_CPU_ACCOUNTING_NATIVE does use it.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Radim Krcmar <rkrcmar@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Link: http://lkml.kernel.org/r/1468421405-20056-5-git-send-email-fweisbec@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | include/linux/vtime.h | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/include/linux/vtime.h b/include/linux/vtime.h index 65aef5e9d04e..aa9bfea8804a 100644 --- a/include/linux/vtime.h +++ b/include/linux/vtime.h | |||
@@ -12,12 +12,9 @@ struct task_struct; | |||
12 | /* | 12 | /* |
13 | * vtime_accounting_cpu_enabled() definitions/declarations | 13 | * vtime_accounting_cpu_enabled() definitions/declarations |
14 | */ | 14 | */ |
15 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE | 15 | #if defined(CONFIG_VIRT_CPU_ACCOUNTING_NATIVE) |
16 | static inline bool vtime_accounting_cpu_enabled(void) { return true; } | 16 | static inline bool vtime_accounting_cpu_enabled(void) { return true; } |
17 | extern void vtime_account_irq_enter(struct task_struct *tsk); | 17 | #elif defined(CONFIG_VIRT_CPU_ACCOUNTING_GEN) |
18 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ | ||
19 | |||
20 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN | ||
21 | /* | 18 | /* |
22 | * Checks if vtime is enabled on some CPU. Cputime readers want to be careful | 19 | * Checks if vtime is enabled on some CPU. Cputime readers want to be careful |
23 | * in that case and compute the tickless cputime. | 20 | * in that case and compute the tickless cputime. |
@@ -38,11 +35,9 @@ static inline bool vtime_accounting_cpu_enabled(void) | |||
38 | 35 | ||
39 | return false; | 36 | return false; |
40 | } | 37 | } |
41 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING_GEN */ | 38 | #else /* !CONFIG_VIRT_CPU_ACCOUNTING */ |
42 | |||
43 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING | ||
44 | static inline bool vtime_accounting_cpu_enabled(void) { return false; } | 39 | static inline bool vtime_accounting_cpu_enabled(void) { return false; } |
45 | #endif /* !CONFIG_VIRT_CPU_ACCOUNTING */ | 40 | #endif |
46 | 41 | ||
47 | 42 | ||
48 | /* | 43 | /* |
@@ -70,14 +65,10 @@ extern void vtime_account_user(struct task_struct *tsk); | |||
70 | static inline void vtime_task_switch(struct task_struct *prev) { } | 65 | static inline void vtime_task_switch(struct task_struct *prev) { } |
71 | static inline void vtime_account_system(struct task_struct *tsk) { } | 66 | static inline void vtime_account_system(struct task_struct *tsk) { } |
72 | static inline void vtime_account_user(struct task_struct *tsk) { } | 67 | static inline void vtime_account_user(struct task_struct *tsk) { } |
73 | static inline void vtime_account_irq_enter(struct task_struct *tsk) { } | ||
74 | #endif /* !CONFIG_VIRT_CPU_ACCOUNTING */ | 68 | #endif /* !CONFIG_VIRT_CPU_ACCOUNTING */ |
75 | 69 | ||
76 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN | 70 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN |
77 | extern void arch_vtime_task_switch(struct task_struct *tsk); | 71 | extern void arch_vtime_task_switch(struct task_struct *tsk); |
78 | static inline void vtime_account_irq_enter(struct task_struct *tsk) { } | ||
79 | static inline void vtime_account_irq_exit(struct task_struct *tsk) { } | ||
80 | |||
81 | extern void vtime_user_enter(struct task_struct *tsk); | 72 | extern void vtime_user_enter(struct task_struct *tsk); |
82 | 73 | ||
83 | static inline void vtime_user_exit(struct task_struct *tsk) | 74 | static inline void vtime_user_exit(struct task_struct *tsk) |
@@ -88,11 +79,6 @@ extern void vtime_guest_enter(struct task_struct *tsk); | |||
88 | extern void vtime_guest_exit(struct task_struct *tsk); | 79 | extern void vtime_guest_exit(struct task_struct *tsk); |
89 | extern void vtime_init_idle(struct task_struct *tsk, int cpu); | 80 | extern void vtime_init_idle(struct task_struct *tsk, int cpu); |
90 | #else /* !CONFIG_VIRT_CPU_ACCOUNTING_GEN */ | 81 | #else /* !CONFIG_VIRT_CPU_ACCOUNTING_GEN */ |
91 | static inline void vtime_account_irq_exit(struct task_struct *tsk) | ||
92 | { | ||
93 | /* On hard|softirq exit we always account to hard|softirq cputime */ | ||
94 | vtime_account_system(tsk); | ||
95 | } | ||
96 | static inline void vtime_user_enter(struct task_struct *tsk) { } | 82 | static inline void vtime_user_enter(struct task_struct *tsk) { } |
97 | static inline void vtime_user_exit(struct task_struct *tsk) { } | 83 | static inline void vtime_user_exit(struct task_struct *tsk) { } |
98 | static inline void vtime_guest_enter(struct task_struct *tsk) { } | 84 | static inline void vtime_guest_enter(struct task_struct *tsk) { } |
@@ -100,6 +86,19 @@ static inline void vtime_guest_exit(struct task_struct *tsk) { } | |||
100 | static inline void vtime_init_idle(struct task_struct *tsk, int cpu) { } | 86 | static inline void vtime_init_idle(struct task_struct *tsk, int cpu) { } |
101 | #endif | 87 | #endif |
102 | 88 | ||
89 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE | ||
90 | extern void vtime_account_irq_enter(struct task_struct *tsk); | ||
91 | static inline void vtime_account_irq_exit(struct task_struct *tsk) | ||
92 | { | ||
93 | /* On hard|softirq exit we always account to hard|softirq cputime */ | ||
94 | vtime_account_system(tsk); | ||
95 | } | ||
96 | #else /* !CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ | ||
97 | static inline void vtime_account_irq_enter(struct task_struct *tsk) { } | ||
98 | static inline void vtime_account_irq_exit(struct task_struct *tsk) { } | ||
99 | #endif | ||
100 | |||
101 | |||
103 | #ifdef CONFIG_IRQ_TIME_ACCOUNTING | 102 | #ifdef CONFIG_IRQ_TIME_ACCOUNTING |
104 | extern void irqtime_account_irq(struct task_struct *tsk); | 103 | extern void irqtime_account_irq(struct task_struct *tsk); |
105 | #else | 104 | #else |