diff options
Diffstat (limited to 'kernel/sched_stats.h')
| -rw-r--r-- | kernel/sched_stats.h | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/kernel/sched_stats.h b/kernel/sched_stats.h index f2773b5d1226..8ab0cef8ecab 100644 --- a/kernel/sched_stats.h +++ b/kernel/sched_stats.h | |||
| @@ -296,6 +296,7 @@ sched_info_switch(struct task_struct *prev, struct task_struct *next) | |||
| 296 | static inline void account_group_user_time(struct task_struct *tsk, | 296 | static inline void account_group_user_time(struct task_struct *tsk, |
| 297 | cputime_t cputime) | 297 | cputime_t cputime) |
| 298 | { | 298 | { |
| 299 | struct task_cputime *times; | ||
| 299 | struct signal_struct *sig; | 300 | struct signal_struct *sig; |
| 300 | 301 | ||
| 301 | /* tsk == current, ensure it is safe to use ->signal */ | 302 | /* tsk == current, ensure it is safe to use ->signal */ |
| @@ -303,13 +304,11 @@ static inline void account_group_user_time(struct task_struct *tsk, | |||
| 303 | return; | 304 | return; |
| 304 | 305 | ||
| 305 | sig = tsk->signal; | 306 | sig = tsk->signal; |
| 306 | if (sig->cputime.totals) { | 307 | times = &sig->cputime.totals; |
| 307 | struct task_cputime *times; | ||
| 308 | 308 | ||
| 309 | times = per_cpu_ptr(sig->cputime.totals, get_cpu()); | 309 | spin_lock(×->lock); |
| 310 | times->utime = cputime_add(times->utime, cputime); | 310 | times->utime = cputime_add(times->utime, cputime); |
| 311 | put_cpu_no_resched(); | 311 | spin_unlock(×->lock); |
| 312 | } | ||
| 313 | } | 312 | } |
| 314 | 313 | ||
| 315 | /** | 314 | /** |
| @@ -325,6 +324,7 @@ static inline void account_group_user_time(struct task_struct *tsk, | |||
| 325 | static inline void account_group_system_time(struct task_struct *tsk, | 324 | static inline void account_group_system_time(struct task_struct *tsk, |
| 326 | cputime_t cputime) | 325 | cputime_t cputime) |
| 327 | { | 326 | { |
| 327 | struct task_cputime *times; | ||
| 328 | struct signal_struct *sig; | 328 | struct signal_struct *sig; |
| 329 | 329 | ||
| 330 | /* tsk == current, ensure it is safe to use ->signal */ | 330 | /* tsk == current, ensure it is safe to use ->signal */ |
| @@ -332,13 +332,11 @@ static inline void account_group_system_time(struct task_struct *tsk, | |||
| 332 | return; | 332 | return; |
| 333 | 333 | ||
| 334 | sig = tsk->signal; | 334 | sig = tsk->signal; |
| 335 | if (sig->cputime.totals) { | 335 | times = &sig->cputime.totals; |
| 336 | struct task_cputime *times; | ||
| 337 | 336 | ||
| 338 | times = per_cpu_ptr(sig->cputime.totals, get_cpu()); | 337 | spin_lock(×->lock); |
| 339 | times->stime = cputime_add(times->stime, cputime); | 338 | times->stime = cputime_add(times->stime, cputime); |
| 340 | put_cpu_no_resched(); | 339 | spin_unlock(×->lock); |
| 341 | } | ||
| 342 | } | 340 | } |
| 343 | 341 | ||
| 344 | /** | 342 | /** |
| @@ -354,6 +352,7 @@ static inline void account_group_system_time(struct task_struct *tsk, | |||
| 354 | static inline void account_group_exec_runtime(struct task_struct *tsk, | 352 | static inline void account_group_exec_runtime(struct task_struct *tsk, |
| 355 | unsigned long long ns) | 353 | unsigned long long ns) |
| 356 | { | 354 | { |
| 355 | struct task_cputime *times; | ||
| 357 | struct signal_struct *sig; | 356 | struct signal_struct *sig; |
| 358 | 357 | ||
| 359 | sig = tsk->signal; | 358 | sig = tsk->signal; |
| @@ -362,11 +361,9 @@ static inline void account_group_exec_runtime(struct task_struct *tsk, | |||
| 362 | if (unlikely(!sig)) | 361 | if (unlikely(!sig)) |
| 363 | return; | 362 | return; |
| 364 | 363 | ||
| 365 | if (sig->cputime.totals) { | 364 | times = &sig->cputime.totals; |
| 366 | struct task_cputime *times; | ||
| 367 | 365 | ||
| 368 | times = per_cpu_ptr(sig->cputime.totals, get_cpu()); | 366 | spin_lock(×->lock); |
| 369 | times->sum_exec_runtime += ns; | 367 | times->sum_exec_runtime += ns; |
| 370 | put_cpu_no_resched(); | 368 | spin_unlock(×->lock); |
| 371 | } | ||
| 372 | } | 369 | } |
