Skip to content

Commit

Permalink
sched/cputime: Use this_cpu_add() in task_group_account_field()
Browse files Browse the repository at this point in the history
Use of a this_cpu() operation reduces the number of instructions used
for accounting (account_user_time()) and frees up some registers. This is in
the scheduler tick hotpath.

Signed-off-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/00000140596dd165-338ff7f5-893b-4fec-b251-aaac5557239e-000000@email.amazonses.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Christoph Lameter authored and Ingo Molnar committed Aug 16, 2013
1 parent c8d2d47 commit a4f61cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/sched/cputime.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static inline void task_group_account_field(struct task_struct *p, int index,
* is the only cgroup, then nothing else should be necessary.
*
*/
__get_cpu_var(kernel_cpustat).cpustat[index] += tmp;
__this_cpu_add(kernel_cpustat.cpustat[index], tmp);

cpuacct_account_field(p, index, tmp);
}
Expand Down

0 comments on commit a4f61cc

Please sign in to comment.