Re: [PATCH] block: fix a crash in do_task_dead()
From: Peter Zijlstra
Date: Thu May 30 2019 - 04:07:52 EST
On Wed, May 29, 2019 at 04:25:26PM -0400, Qian Cai wrote:
> Fixes: 0619317ff8ba ("block: add polled wakeup task helper")
What is the purpose of that patch ?! The Changelog doesn't mention any
benefit or performance gain. So why not revert that?
> Signed-off-by: Qian Cai <cai@xxxxxx>
> ---
> include/linux/blkdev.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 592669bcc536..290eb7528f54 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -1803,7 +1803,7 @@ static inline void blk_wake_io_task(struct task_struct *waiter)
> * that case, we don't need to signal a wakeup, it's enough to just
> * mark us as RUNNING.
> */
> - if (waiter == current)
> + if (waiter == current && in_task())
> __set_current_state(TASK_RUNNING);
NAK, No that's broken too.
The right fix is something like:
if (waiter == current) {
barrier();
if (current->state & TASK_NORAL)
__set_current_state(TASK_RUNNING);
}
But even that is yuck to do outside of the scheduler code, as it looses
tracepoints and stats.
So can we please just revert that original patch and start over -- if
needed?
> else
> wake_up_process(waiter);
> --
> 1.8.3.1
>