diff options
Diffstat (limited to 'kernel/sched/cputime.c')
-rw-r--r-- | kernel/sched/cputime.c | 33 |
1 files changed, 10 insertions, 23 deletions
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; |