aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2009-03-11 21:23:01 -0400
committerIngo Molnar <mingo@elte.hu>2009-03-12 23:54:58 -0400
commit7a46c594bf7f1f2eeb1e12d4b857d5f581957a92 (patch)
tree35731095fd8f01938a36d2647995ee86747e3bbf
parent65a37b29a8d7492f081d4f8da2227467af1c0c1d (diff)
cpuacct: reduce one NULL check in fast-path
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>
-rw-r--r--kernel/sched.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 0a76d0b6f215..61e63562f273 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -9599,10 +9599,11 @@ static void cpuacct_charge(struct task_struct *tsk, u64 cputime)
9599 cpu = task_cpu(tsk); 9599 cpu = task_cpu(tsk);
9600 ca = task_ca(tsk); 9600 ca = task_ca(tsk);
9601 9601
9602 for (; ca; ca = ca->parent) { 9602 do {
9603 u64 *cpuusage = per_cpu_ptr(ca->cpuusage, cpu); 9603 u64 *cpuusage = per_cpu_ptr(ca->cpuusage, cpu);
9604 *cpuusage += cputime; 9604 *cpuusage += cputime;
9605 } 9605 ca = ca->parent;
9606 } while (ca);
9606} 9607}
9607 9608
9608struct cgroup_subsys cpuacct_subsys = { 9609struct cgroup_subsys cpuacct_subsys = {