diff options
Diffstat (limited to 'kernel/posix-cpu-timers.c')
| -rw-r--r-- | kernel/posix-cpu-timers.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index 153dcb2639c3..157de3a47832 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c | |||
| @@ -58,21 +58,21 @@ void thread_group_cputime( | |||
| 58 | struct task_struct *tsk, | 58 | struct task_struct *tsk, |
| 59 | struct task_cputime *times) | 59 | struct task_cputime *times) |
| 60 | { | 60 | { |
| 61 | struct signal_struct *sig; | 61 | struct task_cputime *totals, *tot; |
| 62 | int i; | 62 | int i; |
| 63 | struct task_cputime *tot; | ||
| 64 | 63 | ||
| 65 | sig = tsk->signal; | 64 | totals = tsk->signal->cputime.totals; |
| 66 | if (unlikely(!sig) || !sig->cputime.totals) { | 65 | if (!totals) { |
| 67 | times->utime = tsk->utime; | 66 | times->utime = tsk->utime; |
| 68 | times->stime = tsk->stime; | 67 | times->stime = tsk->stime; |
| 69 | times->sum_exec_runtime = tsk->se.sum_exec_runtime; | 68 | times->sum_exec_runtime = tsk->se.sum_exec_runtime; |
| 70 | return; | 69 | return; |
| 71 | } | 70 | } |
| 71 | |||
| 72 | times->stime = times->utime = cputime_zero; | 72 | times->stime = times->utime = cputime_zero; |
| 73 | times->sum_exec_runtime = 0; | 73 | times->sum_exec_runtime = 0; |
| 74 | for_each_possible_cpu(i) { | 74 | for_each_possible_cpu(i) { |
| 75 | tot = per_cpu_ptr(tsk->signal->cputime.totals, i); | 75 | tot = per_cpu_ptr(totals, i); |
| 76 | times->utime = cputime_add(times->utime, tot->utime); | 76 | times->utime = cputime_add(times->utime, tot->utime); |
| 77 | times->stime = cputime_add(times->stime, tot->stime); | 77 | times->stime = cputime_add(times->stime, tot->stime); |
| 78 | times->sum_exec_runtime += tot->sum_exec_runtime; | 78 | times->sum_exec_runtime += tot->sum_exec_runtime; |
| @@ -311,7 +311,7 @@ static int cpu_clock_sample_group(const clockid_t which_clock, | |||
| 311 | struct task_cputime cputime; | 311 | struct task_cputime cputime; |
| 312 | 312 | ||
| 313 | thread_group_cputime(p, &cputime); | 313 | thread_group_cputime(p, &cputime); |
| 314 | switch (which_clock) { | 314 | switch (CPUCLOCK_WHICH(which_clock)) { |
| 315 | default: | 315 | default: |
| 316 | return -EINVAL; | 316 | return -EINVAL; |
| 317 | case CPUCLOCK_PROF: | 317 | case CPUCLOCK_PROF: |
| @@ -1308,9 +1308,10 @@ static inline int task_cputime_expired(const struct task_cputime *sample, | |||
| 1308 | */ | 1308 | */ |
| 1309 | static inline int fastpath_timer_check(struct task_struct *tsk) | 1309 | static inline int fastpath_timer_check(struct task_struct *tsk) |
| 1310 | { | 1310 | { |
| 1311 | struct signal_struct *sig = tsk->signal; | 1311 | struct signal_struct *sig; |
| 1312 | 1312 | ||
| 1313 | if (unlikely(!sig)) | 1313 | /* tsk == current, ensure it is safe to use ->signal/sighand */ |
| 1314 | if (unlikely(tsk->exit_state)) | ||
| 1314 | return 0; | 1315 | return 0; |
| 1315 | 1316 | ||
| 1316 | if (!task_cputime_zero(&tsk->cputime_expires)) { | 1317 | if (!task_cputime_zero(&tsk->cputime_expires)) { |
| @@ -1323,6 +1324,8 @@ static inline int fastpath_timer_check(struct task_struct *tsk) | |||
| 1323 | if (task_cputime_expired(&task_sample, &tsk->cputime_expires)) | 1324 | if (task_cputime_expired(&task_sample, &tsk->cputime_expires)) |
| 1324 | return 1; | 1325 | return 1; |
| 1325 | } | 1326 | } |
| 1327 | |||
| 1328 | sig = tsk->signal; | ||
| 1326 | if (!task_cputime_zero(&sig->cputime_expires)) { | 1329 | if (!task_cputime_zero(&sig->cputime_expires)) { |
| 1327 | struct task_cputime group_sample; | 1330 | struct task_cputime group_sample; |
| 1328 | 1331 | ||
