diff options
author | Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> | 2009-11-26 00:48:30 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-26 06:59:19 -0500 |
commit | d180c5bccec02612256fd8076ff3c1fac3429553 (patch) | |
tree | 1ef4a45c81531645640380965916c68bbe7f6abb /kernel/exit.c | |
parent | 16bc67edeb49b531940b2ba6c183780a1b5c472d (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/exit.c')
-rw-r--r-- | kernel/exit.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index f7864ac2ecc1..29068ab2670a 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -91,6 +91,8 @@ static void __exit_signal(struct task_struct *tsk) | |||
91 | if (atomic_dec_and_test(&sig->count)) | 91 | if (atomic_dec_and_test(&sig->count)) |
92 | posix_cpu_timers_exit_group(tsk); | 92 | posix_cpu_timers_exit_group(tsk); |
93 | else { | 93 | else { |
94 | cputime_t utime, stime; | ||
95 | |||
94 | /* | 96 | /* |
95 | * If there is any task waiting for the group exit | 97 | * If there is any task waiting for the group exit |
96 | * then notify it: | 98 | * then notify it: |
@@ -110,8 +112,9 @@ static void __exit_signal(struct task_struct *tsk) | |||
110 | * We won't ever get here for the group leader, since it | 112 | * We won't ever get here for the group leader, since it |
111 | * will have been the last reference on the signal_struct. | 113 | * will have been the last reference on the signal_struct. |
112 | */ | 114 | */ |
113 | sig->utime = cputime_add(sig->utime, task_utime(tsk)); | 115 | task_times(tsk, &utime, &stime); |
114 | sig->stime = cputime_add(sig->stime, task_stime(tsk)); | 116 | sig->utime = cputime_add(sig->utime, utime); |
117 | sig->stime = cputime_add(sig->stime, stime); | ||
115 | sig->gtime = cputime_add(sig->gtime, task_gtime(tsk)); | 118 | sig->gtime = cputime_add(sig->gtime, task_gtime(tsk)); |
116 | sig->min_flt += tsk->min_flt; | 119 | sig->min_flt += tsk->min_flt; |
117 | sig->maj_flt += tsk->maj_flt; | 120 | sig->maj_flt += tsk->maj_flt; |