summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Guzik <mjguzik@gmail.com>2026-05-16 05:18:52 +0300
committerChristian Brauner <brauner@kernel.org>2026-05-21 14:39:36 +0300
commit7dc6acb3d56bc2c5d119c86abd8fe96034084fc8 (patch)
tree3e58dea963d36e82e3e73961aa8ce46e53546d3a
parent50d377ef12d9680ff8fd0923afc7edaf63995511 (diff)
downloadlinux-7dc6acb3d56bc2c5d119c86abd8fe96034084fc8.tar.xz
fs/pipe: write to ->poll_usage only once
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> Link: https://patch.msgid.link/20260516021852.256932-1-mjguzik@gmail.com Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
-rw-r--r--fs/pipe.c3
1 files changed, 2 insertions, 1 deletions
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.