Re: [PATCH] pipe_read: don't wake up the writer if the pipe is still full
From: Linus Torvalds
Date: Tue Mar 04 2025 - 01:33:18 EST
On Mon, 3 Mar 2025 at 19:31, K Prateek Nayak <kprateek.nayak@xxxxxxx> wrote:
>
]> > ENTIRELY UNTESTED, but it seems to generate ok code. It might even
> > generate better code than what we have now.
>
> With the patch on top of commit aaec5a95d596 ("pipe_read: don't wake up
> the writer if the pipe is still full"), we've not seen any hangs yet
> with a few thousand iterations of short loops, and a few hundred
> iterations of larger loop sizes with hackbench.
>
> If you can provide you S-o-b, we can send out an official patch with a
> commit log. We'll wait for Oleg's response in case he has any concerns.
Ack. With that testing background, please write a message and add my
Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
and we'll get this all fixed up.
I assume this all goes back to commit 8cefc107ca54 ("pipe: Use head
and tail pointers for the ring, not cursor and length") back in 2019.
Or possibly 85190d15f4ea ("pipe: don't use 'pipe_wait() for basic pipe IO")?
But it was all hidden by the fact that we used to just wake things up
very aggressively and you'd never notice the race as a result, so then
it got exposed by the more minimal wakeup changes.
Linus