lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 12 Dec 2019 17:56:13 -0500
From:   Soheil Hassas Yeganeh <soheil@...gle.com>
To:     Eric Dumazet <edumazet@...gle.com>
Cc:     "David S . Miller" <davem@...emloft.net>,
        netdev <netdev@...r.kernel.org>,
        Neal Cardwell <ncardwell@...gle.com>,
        Jason Baron <jbaron@...mai.com>,
        Eric Dumazet <eric.dumazet@...il.com>
Subject: Re: [PATCH net 3/3] tcp: refine rule to allow EPOLLOUT generation
 under mem pressure

On Thu, Dec 12, 2019 at 3:55 PM Eric Dumazet <edumazet@...gle.com> wrote:
>
> At the time commit ce5ec440994b ("tcp: ensure epoll edge trigger
> wakeup when write queue is empty") was added to the kernel,
> we still had a single write queue, combining rtx and write queues.
>
> Once we moved the rtx queue into a separate rb-tree, testing
> if sk_write_queue is empty has been suboptimal.
>
> Indeed, if we have packets in the rtx queue, we probably want
> to delay the EPOLLOUT generation at the time incoming packets
> will free them, making room, but more importantly avoiding
> flooding application with EPOLLOUT events.
>
> Solution is to use tcp_rtx_and_write_queues_empty() helper.
>
> Fixes: 75c119afe14f ("tcp: implement rb-tree based retransmit queue")
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> Cc: Jason Baron <jbaron@...mai.com>
> Cc: Neal Cardwell <ncardwell@...gle.com>

Acked-by: Soheil Hassas Yeganeh <soheil@...gle.com>

> ---
>  net/ipv4/tcp.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 8a39ee79489192c02385aaadc8d1ae969fb55d23..716938313a32534f312c6b90f66ff7870177b4a5 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -1087,8 +1087,7 @@ ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset,
>                 goto out;
>  out_err:
>         /* make sure we wake any epoll edge trigger waiter */
> -       if (unlikely(skb_queue_len(&sk->sk_write_queue) == 0 &&
> -                    err == -EAGAIN)) {
> +       if (unlikely(tcp_rtx_and_write_queues_empty(sk) && err == -EAGAIN)) {
>                 sk->sk_write_space(sk);
>                 tcp_chrono_stop(sk, TCP_CHRONO_SNDBUF_LIMITED);
>         }
> @@ -1419,8 +1418,7 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size)
>         sock_zerocopy_put_abort(uarg, true);
>         err = sk_stream_error(sk, flags, err);
>         /* make sure we wake any epoll edge trigger waiter */
> -       if (unlikely(skb_queue_len(&sk->sk_write_queue) == 0 &&
> -                    err == -EAGAIN)) {
> +       if (unlikely(tcp_rtx_and_write_queues_empty(sk) && err == -EAGAIN)) {
>                 sk->sk_write_space(sk);
>                 tcp_chrono_stop(sk, TCP_CHRONO_SNDBUF_LIMITED);
>         }
> --
> 2.24.1.735.g03f4e72817-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ