aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2012-12-08 09:44:43 -0500
committerIngo Molnar <mingo@kernel.org>2012-12-08 09:44:43 -0500
commit38130ec08716ae2ece8060eca01607b58da7258c (patch)
tree71d0cd76ccfb2b960ddb6b820850269265389052 /kernel
parente783377e93d4043a11013ce6e9173db34998e653 (diff)
parent1b2852b152be5150fbef7b585388ec43cf6f4415 (diff)
Merge tag 'sched-cputime-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks into sched/core
Pull more cputime cleanups from Frederic Weisbecker: * Get rid of underscores polluting the vtime namespace * Consolidate context switch and tick handling * Improve debuggability by detecting irq unsafe callers Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/cputime.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index b7f731768625..293b202fcf79 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -461,20 +461,33 @@ void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime
461 *st = cputime.stime; 461 *st = cputime.stime;
462} 462}
463 463
464void vtime_account_system(struct task_struct *tsk) 464void vtime_account_system_irqsafe(struct task_struct *tsk)
465{ 465{
466 unsigned long flags; 466 unsigned long flags;
467 467
468 local_irq_save(flags); 468 local_irq_save(flags);
469 __vtime_account_system(tsk); 469 vtime_account_system(tsk);
470 local_irq_restore(flags); 470 local_irq_restore(flags);
471} 471}
472EXPORT_SYMBOL_GPL(vtime_account_system); 472EXPORT_SYMBOL_GPL(vtime_account_system_irqsafe);
473
474#ifndef __ARCH_HAS_VTIME_TASK_SWITCH
475void vtime_task_switch(struct task_struct *prev)
476{
477 if (is_idle_task(prev))
478 vtime_account_idle(prev);
479 else
480 vtime_account_system(prev);
481
482 vtime_account_user(prev);
483 arch_vtime_task_switch(prev);
484}
485#endif
473 486
474/* 487/*
475 * Archs that account the whole time spent in the idle task 488 * Archs that account the whole time spent in the idle task
476 * (outside irq) as idle time can rely on this and just implement 489 * (outside irq) as idle time can rely on this and just implement
477 * __vtime_account_system() and __vtime_account_idle(). Archs that 490 * vtime_account_system() and vtime_account_idle(). Archs that
478 * have other meaning of the idle time (s390 only includes the 491 * have other meaning of the idle time (s390 only includes the
479 * time spent by the CPU when it's in low power mode) must override 492 * time spent by the CPU when it's in low power mode) must override
480 * vtime_account(). 493 * vtime_account().
@@ -482,16 +495,10 @@ EXPORT_SYMBOL_GPL(vtime_account_system);
482#ifndef __ARCH_HAS_VTIME_ACCOUNT 495#ifndef __ARCH_HAS_VTIME_ACCOUNT
483void vtime_account(struct task_struct *tsk) 496void vtime_account(struct task_struct *tsk)
484{ 497{
485 unsigned long flags;
486
487 local_irq_save(flags);
488
489 if (in_interrupt() || !is_idle_task(tsk)) 498 if (in_interrupt() || !is_idle_task(tsk))
490 __vtime_account_system(tsk); 499 vtime_account_system(tsk);
491 else 500 else
492 __vtime_account_idle(tsk); 501 vtime_account_idle(tsk);
493
494 local_irq_restore(flags);
495} 502}
496EXPORT_SYMBOL_GPL(vtime_account); 503EXPORT_SYMBOL_GPL(vtime_account);
497#endif /* __ARCH_HAS_VTIME_ACCOUNT */ 504#endif /* __ARCH_HAS_VTIME_ACCOUNT */