The 3 architectures implementing CONFIG_VIRT_CPU_ACCOUNTING_NATIVE all have their own version of irq time accounting that dispatch the cputime to the appropriate index: hardirq, softirq, system, idle, guest... from an all-in-one function. Instead of having these ad-hoc versions, move the cputime destination dispatch decision to the core code and leave only the actual per-index cputime accounting to the architecture.
Showing the changes to kernel (1 of 5 files). Show all
Unified · Split
| @@ -417,13 +417,18 @@ void vtime_task_switch(struct task_struct *prev) · 416 unmodified lines | ||
| 417 | 417 | } |
| 418 | 418 | # endif |
| 419 | 419 | |
| 420 | −void vtime_account_irq_enter(struct task_struct *tsk) | |
| 420 | +void vtime_account_irq(struct task_struct *tsk) | |
| 421 | 421 | { |
| 422 | − if (!IS_ENABLED(CONFIG_HAVE_VIRT_CPU_ACCOUNTING_IDLE) && | |
| 423 | − !in_interrupt() && is_idle_task(tsk)) | |
| 422 | + if (hardirq_count()) { | |
| 423 | + vtime_account_hardirq(tsk); | |
| 424 | + } else if (in_serving_softirq()) { | |
| 425 | + vtime_account_softirq(tsk); | |
| 426 | + } else if (!IS_ENABLED(CONFIG_HAVE_VIRT_CPU_ACCOUNTING_IDLE) && | |
| 427 | + is_idle_task(tsk)) { | |
| 424 | 428 | vtime_account_idle(tsk); |
| 425 | − else | |
| 429 | + } else { | |
| 426 | 430 | vtime_account_kernel(tsk); |
| 431 | + } | |
| 427 | 432 | } |
| 428 | 433 | |
| 429 | 434 | void cputime_adjust(struct task_cputime *curr, struct prev_cputime *prev, |