diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2016-07-13 10:50:03 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-07-14 04:42:35 -0400 |
commit | 0cfdf9a198b0d4f5ad6c87d894db7830b796b2cc (patch) | |
tree | c679503aab5fdfa6776687d6a9e9d067faffef85 | |
parent | b58c35840521bb02b150e1d0d34ca9197f8b7145 (diff) |
sched/cputime: Clean up the old vtime gen irqtime accounting completely
Vtime generic irqtime accounting has been removed but there are a few
remnants to clean up:
* The vtime_accounting_cpu_enabled() check in irq entry was only used
by CONFIG_VIRT_CPU_ACCOUNTING_GEN. We can safely remove it.
* Without the vtime_accounting_cpu_enabled(), we no longer need to
have a vtime_common_account_irq_enter() indirect function.
* Move vtime_account_irq_enter() implementation under
CONFIG_VIRT_CPU_ACCOUNTING_NATIVE which is the last user.
* The vtime_account_user() call was only used on irq entry for
CONFIG_VIRT_CPU_ACCOUNTING_GEN. We can remove that too.
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-4-git-send-email-fweisbec@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | include/linux/vtime.h | 11 | ||||
-rw-r--r-- | kernel/sched/cputime.c | 33 |
2 files changed, 10 insertions, 34 deletions
diff --git a/include/linux/vtime.h b/include/linux/vtime.h index d1977d84ebdf..65aef5e9d04e 100644 --- a/include/linux/vtime.h +++ b/include/linux/vtime.h | |||
@@ -14,18 +14,7 @@ struct task_struct; | |||
14 | */ | 14 | */ |
15 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE | 15 | #ifdef 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 | |||
18 | #ifdef __ARCH_HAS_VTIME_ACCOUNT | ||
19 | extern void vtime_account_irq_enter(struct task_struct *tsk); | 17 | extern void vtime_account_irq_enter(struct task_struct *tsk); |
20 | #else | ||
21 | extern void vtime_common_account_irq_enter(struct task_struct *tsk); | ||
22 | static inline void vtime_account_irq_enter(struct task_struct *tsk) | ||
23 | { | ||
24 | if (vtime_accounting_cpu_enabled()) | ||
25 | vtime_common_account_irq_enter(tsk); | ||
26 | } | ||
27 | #endif /* __ARCH_HAS_VTIME_ACCOUNT */ | ||
28 | |||
29 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ | 18 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ |
30 | 19 | ||
31 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN | 20 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN |
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index ca7e33cb0967..16a873c203b1 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c | |||
@@ -431,6 +431,10 @@ void vtime_common_task_switch(struct task_struct *prev) | |||
431 | } | 431 | } |
432 | #endif | 432 | #endif |
433 | 433 | ||
434 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING */ | ||
435 | |||
436 | |||
437 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE | ||
434 | /* | 438 | /* |
435 | * Archs that account the whole time spent in the idle task | 439 | * Archs that account the whole time spent in the idle task |
436 | * (outside irq) as idle time can rely on this and just implement | 440 | * (outside irq) as idle time can rely on this and just implement |
@@ -440,33 +444,16 @@ void vtime_common_task_switch(struct task_struct *prev) | |||
440 | * vtime_account(). | 444 | * vtime_account(). |
441 | */ | 445 | */ |
442 | #ifndef __ARCH_HAS_VTIME_ACCOUNT | 446 | #ifndef __ARCH_HAS_VTIME_ACCOUNT |
443 | void vtime_common_account_irq_enter(struct task_struct *tsk) | 447 | void vtime_account_irq_enter(struct task_struct *tsk) |
444 | { | 448 | { |
445 | if (!in_interrupt()) { | 449 | if (!in_interrupt() && is_idle_task(tsk)) |
446 | /* | 450 | vtime_account_idle(tsk); |
447 | * If we interrupted user, context_tracking_in_user() | 451 | else |
448 | * is 1 because the context tracking don't hook | 452 | vtime_account_system(tsk); |
449 | * on irq entry/exit. This way we know if | ||
450 | * we need to flush user time on kernel entry. | ||
451 | */ | ||
452 | if (context_tracking_in_user()) { | ||
453 | vtime_account_user(tsk); | ||
454 | return; | ||
455 | } | ||
456 | |||
457 | if (is_idle_task(tsk)) { | ||
458 | vtime_account_idle(tsk); | ||
459 | return; | ||
460 | } | ||
461 | } | ||
462 | vtime_account_system(tsk); | ||
463 | } | 453 | } |
464 | EXPORT_SYMBOL_GPL(vtime_common_account_irq_enter); | 454 | EXPORT_SYMBOL_GPL(vtime_account_irq_enter); |
465 | #endif /* __ARCH_HAS_VTIME_ACCOUNT */ | 455 | #endif /* __ARCH_HAS_VTIME_ACCOUNT */ |
466 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING */ | ||
467 | |||
468 | 456 | ||
469 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE | ||
470 | void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st) | 457 | void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st) |
471 | { | 458 | { |
472 | *ut = p->utime; | 459 | *ut = p->utime; |