aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched_stats.h
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched_stats.h')
-rw-r--r--kernel/sched_stats.h55
1 files changed, 29 insertions, 26 deletions
diff --git a/kernel/sched_stats.h b/kernel/sched_stats.h
index f2773b5d1226..32d2bd4061b0 100644
--- a/kernel/sched_stats.h
+++ b/kernel/sched_stats.h
@@ -4,7 +4,7 @@
4 * bump this up when changing the output format or the meaning of an existing 4 * bump this up when changing the output format or the meaning of an existing
5 * format, so that tools can adapt (or abort) 5 * format, so that tools can adapt (or abort)
6 */ 6 */
7#define SCHEDSTAT_VERSION 14 7#define SCHEDSTAT_VERSION 15
8 8
9static int show_schedstat(struct seq_file *seq, void *v) 9static int show_schedstat(struct seq_file *seq, void *v)
10{ 10{
@@ -26,9 +26,8 @@ static int show_schedstat(struct seq_file *seq, void *v)
26 26
27 /* runqueue-specific stats */ 27 /* runqueue-specific stats */
28 seq_printf(seq, 28 seq_printf(seq,
29 "cpu%d %u %u %u %u %u %u %u %u %u %llu %llu %lu", 29 "cpu%d %u %u %u %u %u %u %llu %llu %lu",
30 cpu, rq->yld_both_empty, 30 cpu, rq->yld_count,
31 rq->yld_act_empty, rq->yld_exp_empty, rq->yld_count,
32 rq->sched_switch, rq->sched_count, rq->sched_goidle, 31 rq->sched_switch, rq->sched_count, rq->sched_goidle,
33 rq->ttwu_count, rq->ttwu_local, 32 rq->ttwu_count, rq->ttwu_local,
34 rq->rq_cpu_time, 33 rq->rq_cpu_time,
@@ -296,20 +295,21 @@ sched_info_switch(struct task_struct *prev, struct task_struct *next)
296static inline void account_group_user_time(struct task_struct *tsk, 295static inline void account_group_user_time(struct task_struct *tsk,
297 cputime_t cputime) 296 cputime_t cputime)
298{ 297{
299 struct signal_struct *sig; 298 struct thread_group_cputimer *cputimer;
300 299
301 /* tsk == current, ensure it is safe to use ->signal */ 300 /* tsk == current, ensure it is safe to use ->signal */
302 if (unlikely(tsk->exit_state)) 301 if (unlikely(tsk->exit_state))
303 return; 302 return;
304 303
305 sig = tsk->signal; 304 cputimer = &tsk->signal->cputimer;
306 if (sig->cputime.totals) {
307 struct task_cputime *times;
308 305
309 times = per_cpu_ptr(sig->cputime.totals, get_cpu()); 306 if (!cputimer->running)
310 times->utime = cputime_add(times->utime, cputime); 307 return;
311 put_cpu_no_resched(); 308
312 } 309 spin_lock(&cputimer->lock);
310 cputimer->cputime.utime =
311 cputime_add(cputimer->cputime.utime, cputime);
312 spin_unlock(&cputimer->lock);
313} 313}
314 314
315/** 315/**
@@ -325,20 +325,21 @@ static inline void account_group_user_time(struct task_struct *tsk,
325static inline void account_group_system_time(struct task_struct *tsk, 325static inline void account_group_system_time(struct task_struct *tsk,
326 cputime_t cputime) 326 cputime_t cputime)
327{ 327{
328 struct signal_struct *sig; 328 struct thread_group_cputimer *cputimer;
329 329
330 /* tsk == current, ensure it is safe to use ->signal */ 330 /* tsk == current, ensure it is safe to use ->signal */
331 if (unlikely(tsk->exit_state)) 331 if (unlikely(tsk->exit_state))
332 return; 332 return;
333 333
334 sig = tsk->signal; 334 cputimer = &tsk->signal->cputimer;
335 if (sig->cputime.totals) {
336 struct task_cputime *times;
337 335
338 times = per_cpu_ptr(sig->cputime.totals, get_cpu()); 336 if (!cputimer->running)
339 times->stime = cputime_add(times->stime, cputime); 337 return;
340 put_cpu_no_resched(); 338
341 } 339 spin_lock(&cputimer->lock);
340 cputimer->cputime.stime =
341 cputime_add(cputimer->cputime.stime, cputime);
342 spin_unlock(&cputimer->lock);
342} 343}
343 344
344/** 345/**
@@ -354,6 +355,7 @@ static inline void account_group_system_time(struct task_struct *tsk,
354static inline void account_group_exec_runtime(struct task_struct *tsk, 355static inline void account_group_exec_runtime(struct task_struct *tsk,
355 unsigned long long ns) 356 unsigned long long ns)
356{ 357{
358 struct thread_group_cputimer *cputimer;
357 struct signal_struct *sig; 359 struct signal_struct *sig;
358 360
359 sig = tsk->signal; 361 sig = tsk->signal;
@@ -362,11 +364,12 @@ static inline void account_group_exec_runtime(struct task_struct *tsk,
362 if (unlikely(!sig)) 364 if (unlikely(!sig))
363 return; 365 return;
364 366
365 if (sig->cputime.totals) { 367 cputimer = &sig->cputimer;
366 struct task_cputime *times;
367 368
368 times = per_cpu_ptr(sig->cputime.totals, get_cpu()); 369 if (!cputimer->running)
369 times->sum_exec_runtime += ns; 370 return;
370 put_cpu_no_resched(); 371
371 } 372 spin_lock(&cputimer->lock);
373 cputimer->cputime.sum_exec_runtime += ns;
374 spin_unlock(&cputimer->lock);
372} 375}