On Thu, 2012-12-20 at 19:32 +0100, Frederic Weisbecker wrote: > diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c > index da0a9e7..e1fcab4 100644 > --- a/kernel/sched/cputime.c > +++ b/kernel/sched/cputime.c > @@ -317,8 +317,6 @@ out: > rcu_read_unlock(); > } > > -#ifndef CONFIG_VIRT_CPU_ACCOUNTING > - > #ifdef CONFIG_IRQ_TIME_ACCOUNTING > /* > * Account a tick to a process and cpustat > @@ -388,6 +386,7 @@ static void irqtime_account_process_tick(struct > task_struct *p, int user_tick, > struct rq *rq) {} > #endif /* CONFIG_IRQ_TIME_ACCOUNTING */ > > +#ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE > /* > * Account a single tick of cpu time. > * @p: the process that the cpu time gets accounted to > @@ -398,6 +397,11 @@ void account_process_tick(struct task_struct *p, int > user_tick) > cputime_t one_jiffy_scaled = cputime_to_scaled(cputime_one_jiffy); > struct rq *rq = this_rq(); > > + if (vtime_accounting()) { > + vtime_account_user(p); > + return; > + } > + > if (sched_clock_irqtime) { > irqtime_account_process_tick(p, user_tick, rq); > return; > @@ -439,29 +443,13 @@ void account_idle_ticks(unsigned long ticks) > > account_idle_time(jiffies_to_cputime(ticks)); > } > - > #endif > > + > /* > * Use precise platform statistics if available: > */ > #ifdef CONFIG_VIRT_CPU_ACCOUNTING > -void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t > *st) > -{ > - *ut = p->utime; > - *st = p->stime; > -} > - > -void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, > cputime_t *st) > -{ > - struct task_cputime cputime; > - > - thread_group_cputime(p, &cputime); > - > - *ut = cputime.utime; > - *st = cputime.stime; > -} > - > void vtime_account_system_irqsafe(struct task_struct *tsk) > { > unsigned long flags; > @@ -517,8 +505,25 @@ void vtime_account(struct task_struct *tsk) > } > EXPORT_SYMBOL_GPL(vtime_account); > #endif /* __ARCH_HAS_VTIME_ACCOUNT */ > +#endif /* CONFIG_VIRT_CPU_ACCOUNTING */ > > -#else > +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE > +void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t > *st) > +{ > + *ut = p->utime; > + *st = p->stime; > +} > + > +void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, > cputime_t *st) > +{ > + struct task_cputime cputime; > + > + thread_group_cputime(p, &cputime); > + > + *ut = cputime.utime; > + *st = cputime.stime; > +} > +#else /* !CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ > > #ifndef nsecs_to_cputime > # define nsecs_to_cputime(__nsecs) nsecs_to_jiffies(__nsecs) > @@ -548,6 +553,12 @@ static void cputime_adjust(struct task_cputime *curr, > { > cputime_t rtime, utime, total; > > + if (vtime_accounting()) { > + *ut = curr->utime; > + *st = curr->stime; > + return; > + } > + > utime = curr->utime; > total = utime + curr->stime; > > @@ -601,6 +612,7 @@ void thread_group_cputime_adjusted(struct task_struct *p, > cputime_t *ut, cputime > thread_group_cputime(p, &cputime); > cputime_adjust(&cputime, &p->signal->prev_cputime, ut, st); > } > +#endif /* !CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
Ah, the missing #endif gets added back here. -- Steve > > #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN > static DEFINE_PER_CPU(long, last_jiffies) = INITIAL_JIFFIES; > @@ -642,6 +654,11 @@ void vtime_account_idle(struct task_struct *tsk) > account_idle_time(delta_cpu); > } > > +bool vtime_accounting(void) > +{ > + return context_tracking_active(); > +} > + > static int __cpuinit vtime_cpu_notify(struct notifier_block *self, > unsigned long action, void *hcpu) > { > diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c > index fb8e5e4..ad0e6fa 100644 > --- a/kernel/time/tick-sched.c > +++ b/kernel/time/tick-sched.c > @@ -632,8 +632,11 @@ static void tick_nohz_restart_sched_tick(struct > tick_sched *ts, ktime_t now) > > static void tick_nohz_account_idle_ticks(struct tick_sched *ts) > { > -#ifndef CONFIG_VIRT_CPU_ACCOUNTING > +#ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE > unsigned long ticks; > + > + if (vtime_accounting()) > + return; > /* > * We stopped the tick in idle. Update process times would miss the > * time we slept as update_process_times does only a 1 tick -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/