mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch] make pipes use event aware wakeups
@ 2010-12-16 20:32 Davide Libenzi
  2010-12-16 20:35 ` David Miller
  2010-12-16 20:45 ` Eric Dumazet
  0 siblings, 2 replies; 3+ messages in thread
From: Davide Libenzi @ 2010-12-16 20:32 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Andrew Morton

I thought this was alreay merged, but this thread brought to my attention 
it wasn't:

https://lkml.org/lkml/2010/12/15/234

This patch sends the events the wakeup refers to, so that epoll, and even 
the new poll code in fs/select.c can avoid wakeups in events are not 
matching the requested set.


Signed-off-by: Davide Libenzi <davidel@xmailserver.org>


- Davide


---
 fs/pipe.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Index: linux-2.6.mod/fs/pipe.c
===================================================================
--- linux-2.6.mod.orig/fs/pipe.c	2010-12-15 20:49:48.000000000 -0800
+++ linux-2.6.mod/fs/pipe.c	2010-12-15 20:51:42.000000000 -0800
@@ -441,7 +441,7 @@
 			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);
@@ -450,7 +450,7 @@
 
 	/* 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)
@@ -612,7 +612,7 @@
 			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;
 		}
@@ -623,7 +623,7 @@
 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)
@@ -715,7 +715,7 @@
 	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);
 	}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] make pipes use event aware wakeups
  2010-12-16 20:32 [patch] make pipes use event aware wakeups Davide Libenzi
@ 2010-12-16 20:35 ` David Miller
  2010-12-16 20:45 ` Eric Dumazet
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2010-12-16 20:35 UTC (permalink / raw)
  To: davidel; +Cc: linux-kernel, akpm

From: Davide Libenzi <davidel@xmailserver.org>
Date: Thu, 16 Dec 2010 12:32:42 -0800 (PST)

> I thought this was alreay merged, but this thread brought to my attention 
> it wasn't:
> 
> https://lkml.org/lkml/2010/12/15/234
> 
> This patch sends the events the wakeup refers to, so that epoll, and even 
> the new poll code in fs/select.c can avoid wakeups in events are not 
> matching the requested set.
> 
> 
> Signed-off-by: Davide Libenzi <davidel@xmailserver.org>

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] make pipes use event aware wakeups
  2010-12-16 20:32 [patch] make pipes use event aware wakeups Davide Libenzi
  2010-12-16 20:35 ` David Miller
@ 2010-12-16 20:45 ` Eric Dumazet
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2010-12-16 20:45 UTC (permalink / raw)
  To: Davide Libenzi; +Cc: Linux Kernel Mailing List, Andrew Morton

Le jeudi 16 décembre 2010 à 12:32 -0800, Davide Libenzi a écrit :
> I thought this was alreay merged, but this thread brought to my attention 
> it wasn't:
> 
> https://lkml.org/lkml/2010/12/15/234
> 
> This patch sends the events the wakeup refers to, so that epoll, and even 
> the new poll code in fs/select.c can avoid wakeups in events are not 
> matching the requested set.
> 
> 
> Signed-off-by: Davide Libenzi <davidel@xmailserver.org>
> 
> 
> - Davide
> 
> 
> ---
>  fs/pipe.c |   10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> Index: linux-2.6.mod/fs/pipe.c
> ===================================================================
> --- linux-2.6.mod.orig/fs/pipe.c	2010-12-15 20:49:48.000000000 -0800
> +++ linux-2.6.mod/fs/pipe.c	2010-12-15 20:51:42.000000000 -0800
> @@ -441,7 +441,7 @@
>  			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);
> @@ -450,7 +450,7 @@
>  
>  	/* 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)
> @@ -612,7 +612,7 @@
>  			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;
>  		}
> @@ -623,7 +623,7 @@
>  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)
> @@ -715,7 +715,7 @@
>  	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);
>  	}

Indeed ;)

I am not sure the last bit is needed, but it should not matter.

Acked-by: Eric Dumazet <eric.dumazet@gmail.com>




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-16 20:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-16 20:32 [patch] make pipes use event aware wakeups Davide Libenzi
2010-12-16 20:35 ` David Miller
2010-12-16 20:45 ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®