Skip to content

Commit 9f5b0a6

Browse files
MaxKellermannopsiff
authored andcommitted
fs/pipe: remove unnecessary spinlock from pipe_write()
mainline inclusion from mainline-v6.7-rc1 category: performance This reverts commit 8df4412 ("pipe: Check for ring full inside of the spinlock in pipe_write()") which was obsoleted by commit c73be61 ("pipe: Add general notification queue support") because now pipe_write() fails early with -EXDEV if there is a watch_queue. Without a watch_queue, no notifications can be posted to the pipe and mutex protection is enough, as can be seen in splice_pipe_to_pipe() which does not use the spinlock either. Signed-off-by: Max Kellermann <max.kellermann@ionos.com> Message-Id: <20230921075755.1378787-3-max.kellermann@ionos.com> Reviewed-by: David Howells <dhowells@redhat.com> Signed-off-by: Christian Brauner <brauner@kernel.org> (cherry picked from commit dfaabf9) Signed-off-by: Wentao Guan <guanwentao@uniontech.com> Change-Id: I321d4c751c752c5e7e2c1a7b817b0e8cc14f1fe5
1 parent b49f977 commit 9f5b0a6

1 file changed

Lines changed: 0 additions & 9 deletions

File tree

fs/pipe.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -512,16 +512,7 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)
512512
* it, either the reader will consume it or it'll still
513513
* be there for the next write.
514514
*/
515-
spin_lock_irq(&pipe->rd_wait.lock);
516-
517-
head = pipe->head;
518-
if (pipe_full(head, pipe->tail, pipe->max_usage)) {
519-
spin_unlock_irq(&pipe->rd_wait.lock);
520-
continue;
521-
}
522-
523515
pipe->head = head + 1;
524-
spin_unlock_irq(&pipe->rd_wait.lock);
525516

526517
/* Insert it into the buffer array */
527518
buf = &pipe->bufs[head & mask];

0 commit comments

Comments
 (0)