Revert "pipe: avoid unnecessary EPOLLET wakeups under normal loads"

This reverts commit e91da23c1b which is
commit 3b844826b6c6affa80755254da322b017358a2f4 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: Ie785d08c9f6bea569c9cf5623736fa303bff56b1
This commit is contained in:
Greg Kroah-Hartman
2021-09-06 14:26:31 +02:00
parent b6e7497caf
commit 4b20d2de0b
2 changed files with 6 additions and 11 deletions

View File

@@ -444,6 +444,9 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)
#endif
/*
* Epoll nonsensically wants a wakeup whether the pipe
* was already empty or not.
*
* If it wasn't empty we try to merge new data into
* the last buffer.
*
@@ -452,9 +455,9 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)
* spanning multiple pages.
*/
head = pipe->head;
was_empty = pipe_empty(head, pipe->tail);
was_empty = true;
chars = total_len & (PAGE_SIZE-1);
if (chars && !was_empty) {
if (chars && !pipe_empty(head, pipe->tail)) {
unsigned int mask = pipe->ring_size - 1;
struct pipe_buffer *buf = &pipe->bufs[(head - 1) & mask];
int offset = buf->offset + buf->len;
@@ -587,11 +590,8 @@ out:
* This is particularly important for small writes, because of
* how (for example) the GNU make jobserver uses small writes to
* wake up pending jobs
*
* Epoll nonsensically wants a wakeup whether the pipe
* was already empty or not.
*/
if (was_empty || pipe->poll_usage) {
if (was_empty) {
wake_up_interruptible_sync_poll(&pipe->rd_wait, EPOLLIN | EPOLLRDNORM);
kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
}
@@ -654,9 +654,6 @@ pipe_poll(struct file *filp, poll_table *wait)
struct pipe_inode_info *pipe = filp->private_data;
unsigned int head, tail;
/* Epoll has some historical nasty semantics, this enables them */
pipe->poll_usage = 1;
/*
* Reading pipe state only -- no need for acquiring the semaphore.
*

View File

@@ -48,7 +48,6 @@ struct pipe_buffer {
* @files: number of struct file referring this pipe (protected by ->i_lock)
* @r_counter: reader counter
* @w_counter: writer counter
* @poll_usage: is this pipe used for epoll, which has crazy wakeups?
* @fasync_readers: reader side fasync
* @fasync_writers: writer side fasync
* @bufs: the circular array of pipe buffers
@@ -71,7 +70,6 @@ struct pipe_inode_info {
unsigned int files;
unsigned int r_counter;
unsigned int w_counter;
unsigned int poll_usage;
struct page *tmp_page;
struct fasync_struct *fasync_readers;
struct fasync_struct *fasync_writers;