Skip to content

Commit

Permalink
pipe: use event aware wakeups
Browse files Browse the repository at this point in the history
Send the events the wakeup refers to, so that epoll, and even the new poll
code in fs/select.c can avoid wakeups if the events do not match the
requested set.

Signed-off-by: Davide Libenzi <[email protected]>
Acked-by: David S. Miller <[email protected]>
Acked-by: Eric Dumazet <[email protected]>
Cc: Jens Axboe <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
davidel authored and torvalds committed Jan 13, 2011
1 parent 5f829e4 commit e462c44
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions fs/pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov,
break;
}
if (do_wakeup) {
wake_up_interruptible_sync(&pipe->wait);
wake_up_interruptible_sync_poll(&pipe->wait, POLLOUT);
kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
}
pipe_wait(pipe);
Expand All @@ -450,7 +450,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov,

/* Signal writers asynchronously that there is more room. */
if (do_wakeup) {
wake_up_interruptible_sync(&pipe->wait);
wake_up_interruptible_sync_poll(&pipe->wait, POLLOUT);
kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
}
if (ret > 0)
Expand Down Expand Up @@ -612,7 +612,7 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov,
break;
}
if (do_wakeup) {
wake_up_interruptible_sync(&pipe->wait);
wake_up_interruptible_sync_poll(&pipe->wait, POLLIN);
kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
do_wakeup = 0;
}
Expand All @@ -623,7 +623,7 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov,
out:
mutex_unlock(&inode->i_mutex);
if (do_wakeup) {
wake_up_interruptible_sync(&pipe->wait);
wake_up_interruptible_sync_poll(&pipe->wait, POLLIN);
kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
}
if (ret > 0)
Expand Down Expand Up @@ -715,7 +715,7 @@ pipe_release(struct inode *inode, int decr, int decw)
if (!pipe->readers && !pipe->writers) {
free_pipe_info(inode);
} else {
wake_up_interruptible_sync(&pipe->wait);
wake_up_interruptible_sync_poll(&pipe->wait, POLLIN | POLLOUT);
kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
}
Expand Down

0 comments on commit e462c44

Please sign in to comment.