aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/posix-cpu-timers.c35
1 files changed, 1 insertions, 34 deletions
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index 3b7df8653913..c5d1ef530268 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -453,23 +453,6 @@ void posix_cpu_timers_exit_group(struct task_struct *tsk)
453 tsk->se.sum_exec_runtime + sig->sum_sched_runtime); 453 tsk->se.sum_exec_runtime + sig->sum_sched_runtime);
454} 454}
455 455
456static void clear_dead_task(struct k_itimer *itimer, unsigned long long now)
457{
458 struct cpu_timer_list *timer = &itimer->it.cpu;
459
460 /*
461 * That's all for this thread or process.
462 * We leave our residual in expires to be reported.
463 */
464 put_task_struct(timer->task);
465 timer->task = NULL;
466 if (timer->expires < now) {
467 timer->expires = 0;
468 } else {
469 timer->expires -= now;
470 }
471}
472
473static inline int expires_gt(cputime_t expires, cputime_t new_exp) 456static inline int expires_gt(cputime_t expires, cputime_t new_exp)
474{ 457{
475 return expires == 0 || expires > new_exp; 458 return expires == 0 || expires > new_exp;
@@ -832,16 +815,6 @@ static void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp)
832 goto dead; 815 goto dead;
833 } else { 816 } else {
834 cpu_timer_sample_group(timer->it_clock, p, &now); 817 cpu_timer_sample_group(timer->it_clock, p, &now);
835 if (unlikely(p->exit_state) && thread_group_empty(p)) {
836 read_unlock(&tasklist_lock);
837 /*
838 * We've noticed that the thread is dead, but
839 * not yet reaped. Take this opportunity to
840 * drop our task ref.
841 */
842 clear_dead_task(timer, now);
843 goto dead;
844 }
845 } 818 }
846 read_unlock(&tasklist_lock); 819 read_unlock(&tasklist_lock);
847 } 820 }
@@ -1092,14 +1065,8 @@ void posix_cpu_timer_schedule(struct k_itimer *timer)
1092 read_unlock(&tasklist_lock); 1065 read_unlock(&tasklist_lock);
1093 goto out; 1066 goto out;
1094 } else if (unlikely(p->exit_state) && thread_group_empty(p)) { 1067 } else if (unlikely(p->exit_state) && thread_group_empty(p)) {
1095 /*
1096 * We've noticed that the thread is dead, but
1097 * not yet reaped. Take this opportunity to
1098 * drop our task ref.
1099 */
1100 cpu_timer_sample_group(timer->it_clock, p, &now);
1101 clear_dead_task(timer, now);
1102 read_unlock(&tasklist_lock); 1068 read_unlock(&tasklist_lock);
1069 /* Optimizations: if the process is dying, no need to rearm */
1103 goto out; 1070 goto out;
1104 } 1071 }
1105 spin_lock(&p->sighand->siglock); 1072 spin_lock(&p->sighand->siglock);