Re: [tip:sched/core] sched/cpuacct: Split usage accounting into user_usage and sys_usage
From: Peter Zijlstra
Date: Wed Apr 06 2016 - 03:50:15 EST
On Wed, Apr 06, 2016 at 03:47:18PM +0800, Zhao Lei wrote:
> > If you change the above loop to something like:
> >
> > for (ca = task_ca(tsk); ca; ca = parent_ca(ca)) {
> > if (WARN_ON_ONCE(!ca->cpuusage))
> > continue;
> > this_cpu_ptr(ca->cpuusage)->usages[index] += cputime;
>
> Or s/ this_cpu_ptr/get_cpu_var to avoid preempt?
This is all called with rq->lock held, preemption is firmly disabled.