[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wjqnKdrjZx0kO+f1vyFQFcb-HZsbHFw6_jAeuQmNsTsbQ@mail.gmail.com>
Date: Wed, 24 Jun 2020 09:22:30 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Nick Piggin <npiggin@...il.com>,
Peter Zijlstra <peterz@...radead.org>,
Mel Gorman <mgorman@...hsingularity.net>,
Jan Kara <jack@...e.cz>, Davidlohr Bueso <dave@...olabs.net>,
Andi Kleen <ak@...ux.intel.com>,
Lukas Czerner <lczerner@...hat.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: wait_on_page_bit_common(TASK_KILLABLE, EXCLUSIVE) can miss wakeup?
On Wed, Jun 24, 2020 at 9:11 AM Oleg Nesterov <oleg@...hat.com> wrote:
>
> T1 checks signal_pending_state() and returns EINTR.
>
> T2 will sleep until another thread does lock/unlock ?
Yeah, this is a nasty pattern with any exclusive wait, we've had this
bug before where an exclusive wait exits without taking the event or
waking up the next waiter.
That said, I'm not entirely happy with your patch.
The real problem, I feel, is that
if (likely(bit_is_set))
io_schedule();
anti-pattern. Without that, we wouldn't have the bug.
Normally, we'd be TASK_RUNNING in this sequence, but because we might
skip io_schedule(), we can still be in a "sleeping" state here and be
"woken up" between that bit setting and the signal check.
Linus
Powered by blists - more mailing lists