mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	pipe: use event aware wakeups
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 <davidel@xmailserver.org> Acked-by: David S. Miller <davem@davemloft.net> Acked-by: Eric Dumazet <eric.dumazet@gmail.com> Cc: Jens Axboe <axboe@kernel.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									5f829e405e
								
							
						
					
					
						commit
						e462c448fd
					
				
					 1 changed files with 5 additions and 5 deletions
				
			
		
							
								
								
									
										10
									
								
								fs/pipe.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								fs/pipe.c
									
									
									
									
									
								
							| 
						 | 
					@ -441,7 +441,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov,
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (do_wakeup) {
 | 
							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);
 | 
					 			kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		pipe_wait(pipe);
 | 
							pipe_wait(pipe);
 | 
				
			||||||
| 
						 | 
					@ -450,7 +450,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Signal writers asynchronously that there is more room. */
 | 
						/* Signal writers asynchronously that there is more room. */
 | 
				
			||||||
	if (do_wakeup) {
 | 
						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);
 | 
							kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (ret > 0)
 | 
						if (ret > 0)
 | 
				
			||||||
| 
						 | 
					@ -612,7 +612,7 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov,
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (do_wakeup) {
 | 
							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);
 | 
								kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
 | 
				
			||||||
			do_wakeup = 0;
 | 
								do_wakeup = 0;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -623,7 +623,7 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov,
 | 
				
			||||||
out:
 | 
					out:
 | 
				
			||||||
	mutex_unlock(&inode->i_mutex);
 | 
						mutex_unlock(&inode->i_mutex);
 | 
				
			||||||
	if (do_wakeup) {
 | 
						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);
 | 
							kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (ret > 0)
 | 
						if (ret > 0)
 | 
				
			||||||
| 
						 | 
					@ -715,7 +715,7 @@ pipe_release(struct inode *inode, int decr, int decw)
 | 
				
			||||||
	if (!pipe->readers && !pipe->writers) {
 | 
						if (!pipe->readers && !pipe->writers) {
 | 
				
			||||||
		free_pipe_info(inode);
 | 
							free_pipe_info(inode);
 | 
				
			||||||
	} else {
 | 
						} 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_readers, SIGIO, POLL_IN);
 | 
				
			||||||
		kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
 | 
							kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue