Revert "pipe: do FASYNC notifications for every pipe IO, not just state changes"

This reverts commit 3b2018f9c9 which is
commit fe67f4dd8daa252eb9aa7acb61555f3cc3c1ce4c upstream.

It is a nice pipe benchmark improvement, but not really needed for the
android trees, especially as it breaks the abi, so revert it.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Iad762803506a73baa89def463c610d493f8d0bfd
This commit is contained in:
Greg Kroah-Hartman
2021-09-06 14:26:17 +02:00
parent 674d2ac211
commit b6e7497caf

View File

@@ -363,9 +363,10 @@ pipe_read(struct kiocb *iocb, struct iov_iter *to)
* _very_ unlikely case that the pipe was full, but we got * _very_ unlikely case that the pipe was full, but we got
* no data. * no data.
*/ */
if (unlikely(was_full)) if (unlikely(was_full)) {
wake_up_interruptible_sync_poll(&pipe->wr_wait, EPOLLOUT | EPOLLWRNORM); wake_up_interruptible_sync_poll(&pipe->wr_wait, EPOLLOUT | EPOLLWRNORM);
kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT); kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
}
/* /*
* But because we didn't read anything, at this point we can * But because we didn't read anything, at this point we can
@@ -384,11 +385,12 @@ pipe_read(struct kiocb *iocb, struct iov_iter *to)
wake_next_reader = false; wake_next_reader = false;
__pipe_unlock(pipe); __pipe_unlock(pipe);
if (was_full) if (was_full) {
wake_up_interruptible_sync_poll(&pipe->wr_wait, EPOLLOUT | EPOLLWRNORM); wake_up_interruptible_sync_poll(&pipe->wr_wait, EPOLLOUT | EPOLLWRNORM);
kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
}
if (wake_next_reader) if (wake_next_reader)
wake_up_interruptible_sync_poll(&pipe->rd_wait, EPOLLIN | EPOLLRDNORM); wake_up_interruptible_sync_poll(&pipe->rd_wait, EPOLLIN | EPOLLRDNORM);
kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
if (ret > 0) if (ret > 0)
file_accessed(filp); file_accessed(filp);
return ret; return ret;
@@ -563,9 +565,10 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)
* become empty while we dropped the lock. * become empty while we dropped the lock.
*/ */
__pipe_unlock(pipe); __pipe_unlock(pipe);
if (was_empty) if (was_empty) {
wake_up_interruptible_sync_poll(&pipe->rd_wait, EPOLLIN | EPOLLRDNORM); wake_up_interruptible_sync_poll(&pipe->rd_wait, EPOLLIN | EPOLLRDNORM);
kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
}
wait_event_interruptible_exclusive(pipe->wr_wait, pipe_writable(pipe)); wait_event_interruptible_exclusive(pipe->wr_wait, pipe_writable(pipe));
__pipe_lock(pipe); __pipe_lock(pipe);
was_empty = pipe_empty(pipe->head, pipe->tail); was_empty = pipe_empty(pipe->head, pipe->tail);
@@ -588,9 +591,10 @@ out:
* Epoll nonsensically wants a wakeup whether the pipe * Epoll nonsensically wants a wakeup whether the pipe
* was already empty or not. * was already empty or not.
*/ */
if (was_empty || pipe->poll_usage) if (was_empty || pipe->poll_usage) {
wake_up_interruptible_sync_poll(&pipe->rd_wait, EPOLLIN | EPOLLRDNORM); wake_up_interruptible_sync_poll(&pipe->rd_wait, EPOLLIN | EPOLLRDNORM);
kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
}
if (wake_next_writer) if (wake_next_writer)
wake_up_interruptible_sync_poll(&pipe->wr_wait, EPOLLOUT | EPOLLWRNORM); wake_up_interruptible_sync_poll(&pipe->wr_wait, EPOLLOUT | EPOLLWRNORM);
if (ret > 0 && sb_start_write_trylock(file_inode(filp)->i_sb)) { if (ret > 0 && sb_start_write_trylock(file_inode(filp)->i_sb)) {