Re: [RESEND PATCH] fs/pipe: Introduce a check to skip sleeping processes during pipe read/write
From: Oleg Nesterov
Date: Sun Dec 29 2024 - 08:06:28 EST
On 12/29, Manfred Spraul wrote:
>
> >I think that your patch (and the original patch from WangYuli) has the same
> >proble with pipe_poll()->poll_wait()->__pollwait().
>
> What is the memory barrier for pipe_poll()?
>
> There is poll_wait()->__pollwait()->add_wait_queue()->spin_unlock(). thus
> only store_release.
>
> And then READ_ONCE(), i.e. no memory barrier.
>
> Thus the CPU would be free to load pipe->head and pipe->tail before adding
> the entry to the poll table.
>
> Correct?
Yes, this was my thinking.
See also my initial reply to WangYuli
https://lore.kernel.org/all/20241226160007.GA11118@xxxxxxxxxx/
Do you agree?
Oleg.