* [MEH PATCH] fs/pipe: write to ->poll_usage only once
@ 2026-05-16 2:18 Mateusz Guzik
0 siblings, 0 replies; only message in thread
From: Mateusz Guzik @ 2026-05-16 2:18 UTC (permalink / raw)
To: brauner; +Cc: viro, jack, linux-kernel, linux-fsdevel, Mateusz Guzik
Both GNU and BSD makes share a "token pipe" between their instances, as
a result a -j $BIGNUM invocation results in multicore perf problems in
the poll handler.
Avoiding the store will reduce it a little bit. However, the crux of the
problem is the locked queuing up in poll_wait().
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
---
disclaimer: could not be bothered to bench this
fs/pipe.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/pipe.c b/fs/pipe.c
index 9841648c9cf3..e37c79935ecb 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -664,7 +664,8 @@ pipe_poll(struct file *filp, poll_table *wait)
union pipe_index idx;
/* Epoll has some historical nasty semantics, this enables them */
- WRITE_ONCE(pipe->poll_usage, true);
+ if (unlikely(!READ_ONCE(pipe->poll_usage)))
+ WRITE_ONCE(pipe->poll_usage, true);
/*
* Reading pipe state only -- no need for acquiring the semaphore.
--
2.48.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-05-16 2:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-16 2:18 [MEH PATCH] fs/pipe: write to ->poll_usage only once Mateusz Guzik
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.