aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sys.c
diff options
context:
space:
mode:
authorHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>2009-11-26 00:48:30 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-26 06:59:19 -0500
commitd180c5bccec02612256fd8076ff3c1fac3429553 (patch)
tree1ef4a45c81531645640380965916c68bbe7f6abb /kernel/sys.c
parent16bc67edeb49b531940b2ba6c183780a1b5c472d (diff)
sched: Introduce task_times() to replace task_{u,s}time() pair
Functions task_{u,s}time() are called in pair in almost all cases. However task_stime() is implemented to call task_utime() from its inside, so such paired calls run task_utime() twice. It means we do heavy divisions (div_u64 + do_div) twice to get utime and stime which can be obtained at same time by one set of divisions. This patch introduces a function task_times(*tsk, *utime, *stime) to retrieve utime and stime at once in better, optimized way. Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Acked-by: Peter Zijlstra <peterz@infradead.org> Cc: Stanislaw Gruszka <sgruszka@redhat.com> Cc: Spencer Candland <spencer@bluehost.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Balbir Singh <balbir@in.ibm.com> Cc: Americo Wang <xiyou.wangcong@gmail.com> LKML-Reference: <4B0E16AE.906@jp.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sys.c')
-rw-r--r--kernel/sys.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/kernel/sys.c b/kernel/sys.c
index ce17760d9c51..bbdfce0d4347 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1346,8 +1346,7 @@ static void k_getrusage(struct task_struct *p, int who, struct rusage *r)
1346 utime = stime = cputime_zero; 1346 utime = stime = cputime_zero;
1347 1347
1348 if (who == RUSAGE_THREAD) { 1348 if (who == RUSAGE_THREAD) {
1349 utime = task_utime(current); 1349 task_times(current, &utime, &stime);
1350 stime = task_stime(current);
1351 accumulate_thread_rusage(p, r); 1350 accumulate_thread_rusage(p, r);
1352 maxrss = p->signal->maxrss; 1351 maxrss = p->signal->maxrss;
1353 goto out; 1352 goto out;