Re: wait_on_page_bit_common(TASK_KILLABLE, EXCLUSIVE) can miss wakeup?

From: Oleg Nesterov
Date: Mon Jun 29 2020 - 15:14:40 EST


On 06/27, Linus Torvalds wrote:
>
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -1150,6 +1150,12 @@ static inline int wait_on_page_bit_common(wait_queue_head_t *q,
> io_schedule();
>
> if (behavior == EXCLUSIVE) {
> + /*
> + * Make sure we don't get any exclusive wakeups
> + * after this point!
> + */
> + __set_current_state(TASK_RUNNING);
> + smp_mb__before_atomic();
> if (!test_and_set_bit_lock(bit_nr, &page->flags))
> break;
> } else if (behavior == SHARED) {

FWIW,

Reviewed-by: Oleg Nesterov <oleg@xxxxxxxxxx>