]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
cpuacct: reduce one NULL check in fast-path
authorLi Zefan <lizf@cn.fujitsu.com>
Thu, 12 Mar 2009 01:23:01 +0000 (09:23 +0800)
committerIngo Molnar <mingo@elte.hu>
Fri, 13 Mar 2009 03:54:58 +0000 (04:54 +0100)
Impact: micro-optimization

In cpuacct_charge(), task_ca() will never return NULL, so change
for(...) to do { } while(...) to save one NULL check.

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>
Cc: Bharata B Rao <bharata@linux.vnet.ibm.com>
LKML-Reference: <49B863F5.2060400@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/sched.c

index 0a76d0b6f2151e587a1ce04f8c1eba56da95d773..61e63562f2737add49588c4951c9e82b4b7519d0 100644 (file)
@@ -9599,10 +9599,11 @@ static void cpuacct_charge(struct task_struct *tsk, u64 cputime)
        cpu = task_cpu(tsk);
        ca = task_ca(tsk);
 
-       for (; ca; ca = ca->parent) {
+       do {
                u64 *cpuusage = per_cpu_ptr(ca->cpuusage, cpu);
                *cpuusage += cputime;
-       }
+               ca = ca->parent;
+       } while (ca);
 }
 
 struct cgroup_subsys cpuacct_subsys = {