forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/kernel/sched/cpuacct.c
....@@ -5,6 +5,7 @@
55 * Based on the work by Paul Menage (menage@google.com) and Balbir Singh
66 * (balbir@in.ibm.com).
77 */
8
+#include <asm/irq_regs.h>
89 #include "sched.h"
910
1011 /* Time spent by the tasks of the CPU accounting group executing in ... */
....@@ -339,7 +340,7 @@
339340 {
340341 struct cpuacct *ca;
341342 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);
343344
344345 if (regs && user_mode(regs))
345346 index = CPUACCT_STAT_USER;
....@@ -347,7 +348,7 @@
347348 rcu_read_lock();
348349
349350 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);
351352
352353 rcu_read_unlock();
353354 }
....@@ -363,7 +364,7 @@
363364
364365 rcu_read_lock();
365366 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);
367368 rcu_read_unlock();
368369 }
369370