diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2012-11-13 08:20:55 -0500 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2013-01-27 13:23:31 -0500 |
commit | 6fac4829ce0ef9b7f24369086ce5f0e9f38d37bc (patch) | |
tree | 44da712b66d778c2fd701f9c96b00e108530e1a9 /kernel/sched | |
parent | 3f4724ea85b7d9055a9976fa8f30b471bdfbca93 (diff) |
cputime: Use accessors to read task cputime stats
This is in preparation for the full dynticks feature. While
remotely reading the cputime of a task running in a full
dynticks CPU, we'll need to do some extra-computation. This
way we can account the time it spent tickless in userspace
since its last cputime snapshot.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Li Zhong <zhong@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/sched')
-rw-r--r-- | kernel/sched/cputime.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index e1939d38bf73..c533deaf06d5 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c | |||
@@ -164,7 +164,7 @@ void account_user_time(struct task_struct *p, cputime_t cputime, | |||
164 | task_group_account_field(p, index, (__force u64) cputime); | 164 | task_group_account_field(p, index, (__force u64) cputime); |
165 | 165 | ||
166 | /* Account for user time used */ | 166 | /* Account for user time used */ |
167 | acct_update_integrals(p); | 167 | acct_account_cputime(p); |
168 | } | 168 | } |
169 | 169 | ||
170 | /* | 170 | /* |
@@ -214,7 +214,7 @@ void __account_system_time(struct task_struct *p, cputime_t cputime, | |||
214 | task_group_account_field(p, index, (__force u64) cputime); | 214 | task_group_account_field(p, index, (__force u64) cputime); |
215 | 215 | ||
216 | /* Account for system time used */ | 216 | /* Account for system time used */ |
217 | acct_update_integrals(p); | 217 | acct_account_cputime(p); |
218 | } | 218 | } |
219 | 219 | ||
220 | /* | 220 | /* |
@@ -296,6 +296,7 @@ static __always_inline bool steal_account_process_tick(void) | |||
296 | void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times) | 296 | void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times) |
297 | { | 297 | { |
298 | struct signal_struct *sig = tsk->signal; | 298 | struct signal_struct *sig = tsk->signal; |
299 | cputime_t utime, stime; | ||
299 | struct task_struct *t; | 300 | struct task_struct *t; |
300 | 301 | ||
301 | times->utime = sig->utime; | 302 | times->utime = sig->utime; |
@@ -309,8 +310,9 @@ void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times) | |||
309 | 310 | ||
310 | t = tsk; | 311 | t = tsk; |
311 | do { | 312 | do { |
312 | times->utime += t->utime; | 313 | task_cputime(tsk, &utime, &stime); |
313 | times->stime += t->stime; | 314 | times->utime += utime; |
315 | times->stime += stime; | ||
314 | times->sum_exec_runtime += task_sched_runtime(t); | 316 | times->sum_exec_runtime += task_sched_runtime(t); |
315 | } while_each_thread(tsk, t); | 317 | } while_each_thread(tsk, t); |
316 | out: | 318 | out: |
@@ -588,11 +590,10 @@ static void cputime_adjust(struct task_cputime *curr, | |||
588 | void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st) | 590 | void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st) |
589 | { | 591 | { |
590 | struct task_cputime cputime = { | 592 | struct task_cputime cputime = { |
591 | .utime = p->utime, | ||
592 | .stime = p->stime, | ||
593 | .sum_exec_runtime = p->se.sum_exec_runtime, | 593 | .sum_exec_runtime = p->se.sum_exec_runtime, |
594 | }; | 594 | }; |
595 | 595 | ||
596 | task_cputime(p, &cputime.utime, &cputime.stime); | ||
596 | cputime_adjust(&cputime, &p->prev_cputime, ut, st); | 597 | cputime_adjust(&cputime, &p->prev_cputime, ut, st); |
597 | } | 598 | } |
598 | 599 | ||