Re: [PATCH 1/1] do_exit(): Solve possibility of BUG() due to race with try_to_wake_up()

From: Peter Zijlstra
Date: Wed Sep 03 2014 - 05:45:57 EST


On Wed, Sep 03, 2014 at 01:04:36PM +0400, Kirill Tkhai wrote:
> 25.08.2014, 20:01, "Oleg Nesterov" <oleg@xxxxxxxxxx>:
> > Peter, do you remember another problem with TASK_DEAD we discussed recently?
> > (prev_state == TASK_DEAD detection in finish_task_switch() still looks racy).
>
> One more problem with task_dead just to mention it here.
>
> Below is racy with the change of sched_class:
>
> if (prev->sched_class->task_dead)
> prev->sched_class->task_dead(prev);
>
> switched_from_dl() does not cancel running timers.

Well, it does a try_to_cancel() but yes, that can fail. Now I suspect
you cannot actually do hrtimer_cancel() from switched_from because its
called with locks held and the timer function will also try and acquire
those locks.

But yes, that appears to be an actual problem indeed.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/