| .. | .. |
|---|
| 5 | 5 | * Based on the work by Paul Menage (menage@google.com) and Balbir Singh |
|---|
| 6 | 6 | * (balbir@in.ibm.com). |
|---|
| 7 | 7 | */ |
|---|
| 8 | +#include <asm/irq_regs.h> |
|---|
| 8 | 9 | #include "sched.h" |
|---|
| 9 | 10 | |
|---|
| 10 | 11 | /* Time spent by the tasks of the CPU accounting group executing in ... */ |
|---|
| .. | .. |
|---|
| 339 | 340 | { |
|---|
| 340 | 341 | struct cpuacct *ca; |
|---|
| 341 | 342 | int index = CPUACCT_STAT_SYSTEM; |
|---|
| 342 | | - struct pt_regs *regs = task_pt_regs(tsk); |
|---|
| 343 | + struct pt_regs *regs = get_irq_regs() ? : task_pt_regs(tsk); |
|---|
| 343 | 344 | |
|---|
| 344 | 345 | if (regs && user_mode(regs)) |
|---|
| 345 | 346 | index = CPUACCT_STAT_USER; |
|---|
| .. | .. |
|---|
| 347 | 348 | rcu_read_lock(); |
|---|
| 348 | 349 | |
|---|
| 349 | 350 | for (ca = task_ca(tsk); ca; ca = parent_ca(ca)) |
|---|
| 350 | | - this_cpu_ptr(ca->cpuusage)->usages[index] += cputime; |
|---|
| 351 | + __this_cpu_add(ca->cpuusage->usages[index], cputime); |
|---|
| 351 | 352 | |
|---|
| 352 | 353 | rcu_read_unlock(); |
|---|
| 353 | 354 | } |
|---|
| .. | .. |
|---|
| 363 | 364 | |
|---|
| 364 | 365 | rcu_read_lock(); |
|---|
| 365 | 366 | for (ca = task_ca(tsk); ca != &root_cpuacct; ca = parent_ca(ca)) |
|---|
| 366 | | - this_cpu_ptr(ca->cpustat)->cpustat[index] += val; |
|---|
| 367 | + __this_cpu_add(ca->cpustat->cpustat[index], val); |
|---|
| 367 | 368 | rcu_read_unlock(); |
|---|
| 368 | 369 | } |
|---|
| 369 | 370 | |
|---|