diff options
author | Serge Belyshev <belyshev@depni.sinp.msu.ru> | 2016-10-18 09:11:55 +0300 |
---|---|---|
committer | ckolivas <kernel@kolivas.org> | 2016-10-18 18:58:30 +1100 |
commit | 82b49c43d1a0fde701bbe91b6bfbb4c8ef9abf01 (patch) | |
tree | e22e781d529d0ce8ee3091cb625805e5e55ef195 /kernel/sched | |
parent | 974d4b74106b47ecb41b50eceaff22bdb8916dd3 (diff) |
Copy vtime_common_task_switch() and vtime_account_irq_enter() from cputime.c
Diffstat (limited to 'kernel/sched')
-rw-r--r-- | kernel/sched/MuQSS.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/kernel/sched/MuQSS.c b/kernel/sched/MuQSS.c index 62d94509fa4b..94d7461f8435 100644 --- a/kernel/sched/MuQSS.c +++ b/kernel/sched/MuQSS.c @@ -7817,6 +7817,25 @@ void set_curr_task(int cpu, struct task_struct *p) /* * Use precise platform statistics if available: */ +#ifdef CONFIG_VIRT_CPU_ACCOUNTING + +#ifndef __ARCH_HAS_VTIME_TASK_SWITCH +void vtime_common_task_switch(struct task_struct *prev) +{ + if (is_idle_task(prev)) + vtime_account_idle(prev); + else + vtime_account_system(prev); + +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE + vtime_account_user(prev); +#endif + arch_vtime_task_switch(prev); +} +#endif + +#endif /* CONFIG_VIRT_CPU_ACCOUNTING */ + #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st) { @@ -7844,6 +7863,26 @@ void vtime_account_system_irqsafe(struct task_struct *tsk) local_irq_restore(flags); } EXPORT_SYMBOL_GPL(vtime_account_system_irqsafe); + +/* + * Archs that account the whole time spent in the idle task + * (outside irq) as idle time can rely on this and just implement + * vtime_account_system() and vtime_account_idle(). Archs that + * have other meaning of the idle time (s390 only includes the + * time spent by the CPU when it's in low power mode) must override + * vtime_account(). + */ +#ifndef __ARCH_HAS_VTIME_ACCOUNT +void vtime_account_irq_enter(struct task_struct *tsk) +{ + if (!in_interrupt() && is_idle_task(tsk)) + vtime_account_idle(tsk); + else + vtime_account_system(tsk); +} +EXPORT_SYMBOL_GPL(vtime_account_irq_enter); +#endif /* __ARCH_HAS_VTIME_ACCOUNT */ + #else /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ /* * Perform (stime * rtime) / total, but avoid multiplication overflow by |