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 /include | |
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 'include')
-rw-r--r-- | include/linux/sched.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 78ba664474f3..fe6ae1516640 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1723,6 +1723,7 @@ static inline void put_task_struct(struct task_struct *t) | |||
1723 | extern cputime_t task_utime(struct task_struct *p); | 1723 | extern cputime_t task_utime(struct task_struct *p); |
1724 | extern cputime_t task_stime(struct task_struct *p); | 1724 | extern cputime_t task_stime(struct task_struct *p); |
1725 | extern cputime_t task_gtime(struct task_struct *p); | 1725 | extern cputime_t task_gtime(struct task_struct *p); |
1726 | extern void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st); | ||
1726 | 1727 | ||
1727 | /* | 1728 | /* |
1728 | * Per process flags | 1729 | * Per process flags |