Skip to content

Commit

Permalink
cpuacct: add a branch prediction
Browse files Browse the repository at this point in the history
cpuacct_charge() is in fast-path, and checking of !cpuacct_susys.active
always returns false after cpuacct has been initialized at system boot.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Menage <menage@google.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Li Zefan authored and Ingo Molnar committed Feb 26, 2009
1 parent 4434e51 commit c40c6f8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -9684,7 +9684,7 @@ static void cpuacct_charge(struct task_struct *tsk, u64 cputime)
struct cpuacct *ca;
int cpu;

if (!cpuacct_subsys.active)
if (unlikely(!cpuacct_subsys.active))
return;

cpu = task_cpu(tsk);
Expand Down

0 comments on commit c40c6f8

Please sign in to comment.