All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: John Dykstra <john.dykstra1@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Linux Netdev List <netdev@vger.kernel.org>
Subject: Re: [PATCH] tcp: tcp_prequeue() can use keyed wakeups
Date: Wed, 13 May 2009 05:28:26 +0200	[thread overview]
Message-ID: <4A0A3E5A.6040702@cosmosbay.com> (raw)
In-Reply-To: <1242178490.11389.20.camel@merlyn>

John Dykstra a écrit :
> On Thu, 2009-05-07 at 19:20 +0200, Eric Dumazet wrote:
>> We can avoid waking up tasks not interested in receive notifications,
>> using wake_up_interruptible_poll() instead of wake_up_interruptible()
> 
> Is there any reason why we shouldn't do the same thing on the write
> side?

No special reason, apart that this event is not so frequent.

(For tcp, sock_wfree() doesnt call ->sk_write_space())

I wonder if sk_stream_write_space() is actually called at all, I never got it in profiles :)

I see it is called from setsockopt(SO_SNFBUF),
and from tcp_new_space() only if SOCK_NOSPACE was set.

To see a benefit of this patch, we would need two threads, one blocked in a recv(),
one blocked in a send() on same socket (or a poll/epoll user with same bi-directional trafic)

Acked-by: Eric Dumazet <dada1@cosmosbay.com>

> 
> Compile-tested only.
> 
>   --  John
> 
> ---
> [PATCH net-next-2.6] tcp: Don't wake up reading threads on write space 
> 
> When TCP frees up write buffer space, avoid waking up tasks that have
> done a poll() or select() on the same socket specifying read-side
> events.
> 
> This is an extension of a read-side patch by Eric Dumazet.
> 
> Signed-off-by: John Dykstra <john.dykstra1@gmail.com>
> ---
>  net/core/stream.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/net/core/stream.c b/net/core/stream.c
> index 8727cea..a37debf 100644
> --- a/net/core/stream.c
> +++ b/net/core/stream.c
> @@ -33,7 +33,8 @@ void sk_stream_write_space(struct sock *sk)
>  		clear_bit(SOCK_NOSPACE, &sock->flags);
>  
>  		if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
> -			wake_up_interruptible(sk->sk_sleep);
> +			wake_up_interruptible_poll(sk->sk_sleep, POLLOUT |
> +						POLLWRNORM | POLLWRBAND);
>  		if (sock->fasync_list && !(sk->sk_shutdown & SEND_SHUTDOWN))
>  			sock_wake_async(sock, SOCK_WAKE_SPACE, POLL_OUT);
>  	}



  reply	other threads:[~2009-05-13  3:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-07 17:08 [PATCH] tcp: tcp_prequeue() cleanup Eric Dumazet
2009-05-07 17:20 ` [PATCH] tcp: tcp_prequeue() can use keyed wakeups Eric Dumazet
2009-05-07 21:55   ` David Miller
2009-05-13  1:34   ` John Dykstra
2009-05-13  3:28     ` Eric Dumazet [this message]
2009-05-13 15:05       ` John Dykstra
2009-05-18  3:45         ` David Miller
2009-05-07 21:55 ` [PATCH] tcp: tcp_prequeue() cleanup David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A0A3E5A.6040702@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=davem@davemloft.net \
    --cc=john.dykstra1@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.