diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched/cputime.c | 31 |
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 | ||
464 | void vtime_account_system(struct task_struct *tsk) | 464 | void 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 | } |
472 | EXPORT_SYMBOL_GPL(vtime_account_system); | 472 | EXPORT_SYMBOL_GPL(vtime_account_system_irqsafe); |
473 | |||
474 | #ifndef __ARCH_HAS_VTIME_TASK_SWITCH | ||
475 | void 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 |
483 | void vtime_account(struct task_struct *tsk) | 496 | void 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 | } |
496 | EXPORT_SYMBOL_GPL(vtime_account); | 503 | EXPORT_SYMBOL_GPL(vtime_account); |
497 | #endif /* __ARCH_HAS_VTIME_ACCOUNT */ | 504 | #endif /* __ARCH_HAS_VTIME_ACCOUNT */ |