All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jason Baron <jbaron@akamai.com>
Cc: edumazet@google.com, davem@davemloft.net, netdev@vger.kernel.org,
	ncardwell@google.com, ycheng@google.com
Subject: Re: [PATCH] tcp: ensure epoll edge trigger wakeup when out of memory
Date: Sun, 17 May 2015 19:50:54 -0700	[thread overview]
Message-ID: <1431917454.621.21.camel@edumazet-glaptop2.roam.corp.google.com> (raw)
In-Reply-To: <20150515211707.D9FC480066@prod-mail-relay07.akamai.com>

On Fri, 2015-05-15 at 21:17 +0000, Jason Baron wrote:
> From: Jason Baron <jbaron@akamai.com>
> 
> If we really can't get an skb allocated, make sure that we let
> userspace know. This at least gives us a chance to re-try or abort.
> 
> Signed-off-by: Jason Baron <jbaron@akamai.com>
> ---
>  net/ipv4/tcp.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index ecccfdc..d7d85e8 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -986,6 +986,9 @@ do_error:
>  	if (copied)
>  		goto out;
>  out_err:
> +	/* make sure we wake any epoll edge trigger waiter */
> +	if (unlikely(sk->sk_write_queue == 0 && err == -EAGAIN))
> +		sk->sk_write_space(sk);
>  	return sk_stream_error(sk, flags, err);
>  }
>  
> @@ -1274,6 +1277,9 @@ do_error:
>  		goto out;
>  out_err:
>  	err = sk_stream_error(sk, flags, err);
> +	/* make sure we wake any epoll edge trigger waiter */
> +	if (unlikely(sk->sk_write_queue == 0 && err == -EAGAIN))
> +		sk->sk_write_space(sk);
>  	release_sock(sk);
>  	return err;
>  }

I wonder if we should return ENOMEM here, otherwise application has no
way to avoid to spin forever ?

  reply	other threads:[~2015-05-18  2:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-15 21:17 [PATCH] tcp: ensure epoll edge trigger wakeup when out of memory Jason Baron
2015-05-18  2:50 ` Eric Dumazet [this message]
2015-05-19  4:09 ` David Miller
2015-05-19  4:10   ` David Miller
2015-05-19 14:10     ` Jason Baron

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=1431917454.621.21.camel@edumazet-glaptop2.roam.corp.google.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jbaron@akamai.com \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=ycheng@google.com \
    /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.