diff options
author | Max Kellermann <max.kellermann@ionos.com> | 2023-09-21 09:57:55 +0200 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2023-10-19 11:02:48 +0200 |
commit | 478dbf12176700f28d836dd03ae93a6888278230 (patch) | |
tree | e6ccefe57219ed1d32cbac4ad597b1c9b5af8d19 /fs/9p | |
parent | dfaabf916b1ca83cfac856745db2fc9d57d9b13a (diff) |
fs/pipe: use spinlock in pipe_read() only if there is a watch_queue
If there is no watch_queue, holding the pipe mutex is enough to
prevent concurrent writes, and we can avoid the spinlock.
O_NOTIFICATION_QUEUE is an exotic and rarely used feature, and of all
the pipes that exist at any given time, only very few actually have a
watch_queue, therefore it appears worthwile to optimize the common
case.
This patch does not optimize pipe_resize_ring() where the spinlocks
could be avoided as well; that does not seem like a worthwile
optimization because this function is not called often.
Related commits:
- commit 8df441294dd3 ("pipe: Check for ring full inside of the
spinlock in pipe_write()")
- commit b667b8673443 ("pipe: Advance tail pointer inside of wait
spinlock in pipe_read()")
- commit 189b0ddc2451 ("pipe: Fix missing lock in pipe_resize_ring()")
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
Message-Id: <20230921075755.1378787-4-max.kellermann@ionos.com>
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/9p')
0 files changed, 0 insertions, 0 deletions