History

sched/vtime: Consolidate IRQ time accounting

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.

Frederic Weisbecker committed 5 years ago

Commit 8a6a5921 parent 2b91ec95 files · +102 −48Browse files

Showing the changes to kernel (1 of 5 files). Show all

Unified · Split

kernel/sched/cputime.c+9−4
@@ -417,13 +417,18 @@ void vtime_task_switch(struct task_struct *prev) · 416 unmodified lines
417}417}
418# endif418# endif
419 419
420void vtime_account_irq_enter(struct task_struct *tsk)420void vtime_account_irq(struct task_struct *tsk)
421{421{
422 if (!IS_ENABLED(CONFIG_HAVE_VIRT_CPU_ACCOUNTING_IDLE) &&422 if (hardirq_count()) {
423 !in_interrupt() && is_idle_task(tsk))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 vtime_account_idle(tsk);428 vtime_account_idle(tsk);
425 else429 } else {
426 vtime_account_kernel(tsk);430 vtime_account_kernel(tsk);
431 }
427}432}
428 433
429void cputime_adjust(struct task_cputime *curr, struct prev_cputime *prev,434void cputime_adjust(struct task_cputime *curr, struct prev_cputime *prev,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t