Re: [PATCH] pipe_read: don't wake up the writer if the pipe is still full

From: Hillf Danton
Date: Tue Mar 04 2025 - 23:56:53 EST


On Wed, 5 Mar 2025 00:49:09 +0100 Oleg Nesterov <oleg@xxxxxxxxxx>
>
> Of course! Again, whatever the woken writer checks in pipe_writable()
> lockless, another writer can make pipe_full() true again.
>
> But why do we care? Why do you think that the change you propose makes

Because of the hang reported.

> more sense than the fix from Prateek or the (already merged) Linus's fix?
>
See the loop in ___wait_event(),

for (;;) {
prepare_to_wait_event();

// flip
if (condition)
break;

schedule();
}

After wakeup, waiter will sleep again if condition flips false on the waker
side before waiter checks condition, even if condition is atomic, no?