Commit a3222f88 authored by Frederic Weisbecker's avatar Frederic Weisbecker

posix-timers: Remove dead task special case

Now that we've removed all the optimizations that could
result in NULL timer's targets, we can remove all the
associated special case handling.

Also add some warnings on NULL targets to spot any possible
leftover.
Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kosaki Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
parent e26d70d2
......@@ -374,7 +374,8 @@ static int posix_cpu_timer_del(struct k_itimer *timer)
struct task_struct *p = timer->it.cpu.task;
int ret = 0;
if (likely(p != NULL)) {
WARN_ON_ONCE(p == NULL);
read_lock(&tasklist_lock);
if (unlikely(p->sighand == NULL)) {
/*
......@@ -394,7 +395,6 @@ static int posix_cpu_timer_del(struct k_itimer *timer)
if (!ret)
put_task_struct(p);
}
return ret;
}
......@@ -622,12 +622,7 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int flags,
unsigned long long old_expires, new_expires, old_incr, val;
int ret;
if (unlikely(p == NULL)) {
/*
* Timer refers to a dead task's clock.
*/
return -ESRCH;
}
WARN_ON_ONCE(p == NULL);
new_expires = timespec_to_sample(timer->it_clock, &new->it_value);
......@@ -770,6 +765,8 @@ static void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp)
unsigned long long now;
struct task_struct *p = timer->it.cpu.task;
WARN_ON_ONCE(p == NULL);
/*
* Easy part: convert the reload time.
*/
......@@ -781,18 +778,6 @@ static void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp)
return;
}
if (unlikely(p == NULL)) {
WARN_ON_ONCE(CPUCLOCK_PERTHREAD(timer->it_clock));
/*
* This task already died and the timer will never fire.
* In this case, expires is actually the dead value.
*/
dead:
sample_to_timespec(timer->it_clock, timer->it.cpu.expires,
&itp->it_value);
return;
}
/*
* Sample the clock to take the difference with the expiry time.
*/
......@@ -807,8 +792,9 @@ static void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp)
* Call the timer disarmed, nothing else to do.
*/
timer->it.cpu.expires = 0;
sample_to_timespec(timer->it_clock, timer->it.cpu.expires,
&itp->it_value);
read_unlock(&tasklist_lock);
goto dead;
} else {
cpu_timer_sample_group(timer->it_clock, p, &now);
}
......@@ -1029,13 +1015,7 @@ void posix_cpu_timer_schedule(struct k_itimer *timer)
struct task_struct *p = timer->it.cpu.task;
unsigned long long now;
if (unlikely(p == NULL)) {
WARN_ON_ONCE(CPUCLOCK_PERTHREAD(timer->it_clock));
/*
* The task was cleaned up already, no future firings.
*/
goto out;
}
WARN_ON_ONCE(p == NULL);
/*
* Fetch the current sample and update the timer's expiry time.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment