diff options
-rw-r--r-- | kernel/posix-cpu-timers.c | 24 | ||||
-rw-r--r-- | kernel/sched/cputime.c | 28 |
2 files changed, 28 insertions, 24 deletions
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index 125cb67daa21..d73840271dce 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c | |||
@@ -217,30 +217,6 @@ static int cpu_clock_sample(const clockid_t which_clock, struct task_struct *p, | |||
217 | return 0; | 217 | return 0; |
218 | } | 218 | } |
219 | 219 | ||
220 | void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times) | ||
221 | { | ||
222 | struct signal_struct *sig = tsk->signal; | ||
223 | struct task_struct *t; | ||
224 | |||
225 | times->utime = sig->utime; | ||
226 | times->stime = sig->stime; | ||
227 | times->sum_exec_runtime = sig->sum_sched_runtime; | ||
228 | |||
229 | rcu_read_lock(); | ||
230 | /* make sure we can trust tsk->thread_group list */ | ||
231 | if (!likely(pid_alive(tsk))) | ||
232 | goto out; | ||
233 | |||
234 | t = tsk; | ||
235 | do { | ||
236 | times->utime += t->utime; | ||
237 | times->stime += t->stime; | ||
238 | times->sum_exec_runtime += task_sched_runtime(t); | ||
239 | } while_each_thread(tsk, t); | ||
240 | out: | ||
241 | rcu_read_unlock(); | ||
242 | } | ||
243 | |||
244 | static void update_gt_cputime(struct task_cputime *a, struct task_cputime *b) | 220 | static void update_gt_cputime(struct task_cputime *a, struct task_cputime *b) |
245 | { | 221 | { |
246 | if (b->utime > a->utime) | 222 | if (b->utime > a->utime) |
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index 8d859dae5bed..e56f138a23c7 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c | |||
@@ -288,6 +288,34 @@ static __always_inline bool steal_account_process_tick(void) | |||
288 | return false; | 288 | return false; |
289 | } | 289 | } |
290 | 290 | ||
291 | /* | ||
292 | * Accumulate raw cputime values of dead tasks (sig->[us]time) and live | ||
293 | * tasks (sum on group iteration) belonging to @tsk's group. | ||
294 | */ | ||
295 | void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times) | ||
296 | { | ||
297 | struct signal_struct *sig = tsk->signal; | ||
298 | struct task_struct *t; | ||
299 | |||
300 | times->utime = sig->utime; | ||
301 | times->stime = sig->stime; | ||
302 | times->sum_exec_runtime = sig->sum_sched_runtime; | ||
303 | |||
304 | rcu_read_lock(); | ||
305 | /* make sure we can trust tsk->thread_group list */ | ||
306 | if (!likely(pid_alive(tsk))) | ||
307 | goto out; | ||
308 | |||
309 | t = tsk; | ||
310 | do { | ||
311 | times->utime += t->utime; | ||
312 | times->stime += t->stime; | ||
313 | times->sum_exec_runtime += task_sched_runtime(t); | ||
314 | } while_each_thread(tsk, t); | ||
315 | out: | ||
316 | rcu_read_unlock(); | ||
317 | } | ||
318 | |||
291 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING | 319 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING |
292 | 320 | ||
293 | #ifdef CONFIG_IRQ_TIME_ACCOUNTING | 321 | #ifdef CONFIG_IRQ_TIME_ACCOUNTING |