1 #include <linux/export.h>
2 #include <linux/sched.h>
9 #ifdef CONFIG_IRQ_TIME_ACCOUNTING
28 void enable_sched_clock_irqtime(
void)
33 void disable_sched_clock_irqtime(
void)
61 irq_time_write_begin();
78 static int irqtime_account_hi_update(
void)
93 static int irqtime_account_si_update(
void)
110 #define sched_clock_irqtime (0)
117 #ifdef CONFIG_CGROUP_CPUACCT
129 #ifdef CONFIG_CGROUP_CPUACCT
130 if (
unlikely(!cpuacct_subsys.active))
135 while (ca && (ca != &root_cpuacct)) {
158 account_group_user_time(p, cputime);
163 task_group_account_field(p, index, (
__force u64) cputime);
166 acct_update_integrals(p);
183 account_group_user_time(p, cputime);
210 account_group_system_time(p, cputime);
213 task_group_account_field(p, index, (
__force u64) cputime);
216 acct_update_integrals(p);
232 account_guest_time(p, cputime, cputime_scaled);
243 __account_system_time(p, cputime, cputime_scaled, index);
274 #ifdef CONFIG_PARAVIRT
279 steal -=
this_rq()->prev_steal_time;
281 st = steal_ticks(steal);
291 #ifndef CONFIG_VIRT_CPU_ACCOUNTING
293 #ifdef CONFIG_IRQ_TIME_ACCOUNTING
315 static void irqtime_account_process_tick(
struct task_struct *p,
int user_tick,
321 if (steal_account_process_tick())
324 if (irqtime_account_hi_update()) {
326 }
else if (irqtime_account_si_update()) {
328 }
else if (this_cpu_ksoftirqd() ==
p) {
336 }
else if (user_tick) {
338 }
else if (p == rq->
idle) {
348 static void irqtime_account_idle_ticks(
int ticks)
353 for (i = 0; i <
ticks; i++)
354 irqtime_account_process_tick(
current, 0, rq);
357 static void irqtime_account_idle_ticks(
int ticks) {}
358 static void irqtime_account_process_tick(
struct task_struct *p,
int user_tick,
373 irqtime_account_process_tick(p, user_tick, rq);
377 if (steal_account_process_tick())
407 irqtime_account_idle_ticks(ticks);
419 #ifdef CONFIG_VIRT_CPU_ACCOUNTING
444 #ifndef __ARCH_HAS_VTIME_ACCOUNT
452 vtime_account_system(tsk);
454 vtime_account_idle(tsk);
463 #ifndef nsecs_to_cputime
464 # define nsecs_to_cputime(__nsecs) nsecs_to_jiffies(__nsecs)
491 utime = scale_utime(utime, rtime, total);
520 utime = scale_utime(cputime.
utime, rtime, total);