Re: [RESEND PATCH] fs/pipe: Introduce a check to skip sleeping processes during pipe read/write
From: Oleg Nesterov
Date: Mon Dec 30 2024 - 10:39:28 EST
Hi Manfred,
On 12/29, Manfred Spraul wrote:
>
> Hi Oleg,
>
> On 12/29/24 2:13 PM, Oleg Nesterov wrote:
> >Sorry for the noise...
> >
> >and currently this is fine.
Heh, please see below.
> But if we want to add the wq_has_sleeper()
> >checks into fs/pipe.c then pipe_poll() needs smp_mb() after it calls
> >poll_wait().
> >
> >Agreed?
>
> Yes, agreed.
>
> Just the comment in pipe_poll() was a bit tricky for me.
Well yes, but... It turns out I didn't grep enough.
See fs/splice.c and wakeup_pipe_readers/writers (which should use
wq_has_sleeper() for grep sake). And I don't understand why do these helpers
use key == NULL...
So it seems that pipe_poll() already needs smp_mb() to fix the current code,
at least in theory. I'll recheck and send the patch(es).
Oleg.