Re: [PATCH 1/2] sched/wait: Break up long wake list walk
From: Peter Zijlstra
Date: Tue Aug 22 2017 - 14:56:49 EST
On Tue, Aug 22, 2017 at 11:19:12AM -0700, Linus Torvalds wrote:
> diff --git a/mm/filemap.c b/mm/filemap.c
> index a49702445ce0..75c29a1f90fb 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -991,13 +991,11 @@ static inline int wait_on_page_bit_common(wait_queue_head_t *q,
> }
> }
>
> - if (lock) {
> - if (!test_and_set_bit_lock(bit_nr, &page->flags))
> - break;
> - } else {
> - if (!test_bit(bit_nr, &page->flags))
> - break;
> - }
> + if (!lock)
> + break;
> +
> + if (!test_and_set_bit_lock(bit_nr, &page->flags))
> + break;
> }
Won't we now prematurely terminate the wait when we get a spurious
wakeup?