[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 19 Oct 2016 18:54:30 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
James Morris <jmorris@...ei.org>,
Trond Myklebust <trond.myklebust@...marydata.com>,
Alexander Duyck <aduyck@...antis.com>,
Daniel Borkmann <daniel@...earbox.net>,
Eric Dumazet <edumazet@...gle.com>,
Tom Herbert <tom@...bertland.com>,
Hannes Frederic Sowa <hannes@...essinduktion.org>,
Edward Cree <ecree@...arflare.com>, linux-nfs@...r.kernel.org
Subject: Re: [PATCH net-next v4 3/3] udp: use it's own memory accounting
schema
On Wed, 2016-10-19 at 14:47 +0200, Paolo Abeni wrote:
> Completely avoid default sock memory accounting and replace it
> with udp-specific accounting.
>
> Since the new memory accounting model encapsulates completely
> the required locking, remove the socket lock on both enqueue and
> dequeue, and avoid using the backlog on enqueue.
>
> Be sure to clean-up rx queue memory on socket destruction, using
> udp its own sk_destruct.
>
> Tested using pktgen with random src port, 64 bytes packet,
> wire-speed on a 10G link as sender and udp_sink as the receiver,
> using an l4 tuple rxhash to stress the contention, and one or more
> udp_sink instances with reuseport.
>
> nr readers Kpps (vanilla) Kpps (patched)
> 1 170 420
> 3 1250 1900
> 6 3000 3500
> 9 4200 4400
> 12 5700 6100
>
> v3 -> v4:
> - remove useless sk_rcvqueues_full() call
>
> v2 -> v3:
> - do not set the now unsed backlog_rcv callback
>
> v1 -> v2:
> - add memory pressure support
> - fixed dropwatch accounting for ipv6
>
> Acked-by: Hannes Frederic Sowa <hannes@...essinduktion.org>
> Signed-off-by: Paolo Abeni <pabeni@...hat.com>
> ---
> net/ipv4/udp.c | 42 ++++++++----------------------------------
> net/ipv6/udp.c | 34 ++++++++--------------------------
> net/sunrpc/svcsock.c | 20 ++++++++++++++++----
> net/sunrpc/xprtsock.c | 2 +-
> 4 files changed, 33 insertions(+), 65 deletions(-)
>
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index 7047bb3..1925ca7 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -1312,13 +1312,8 @@ static int first_packet_length(struct sock *sk)
> res = skb ? skb->len : -1;
> spin_unlock_bh(&rcvq->lock);
>
> - if (!skb_queue_empty(&list_kill)) {
> - bool slow = lock_sock_fast(sk);
> -
> + if (!skb_queue_empty(&list_kill))
> __skb_queue_purge(&list_kill);
> - sk_mem_reclaim_partial(sk);
> - unlock_sock_fast(sk, slow);
> - }
Simply call __skb_queue_purge(&list_kill);
(without testing if list_kill is empty or not)
> return res;
> }
>
We also could remove list_kill and directly call kfree_skb() in the
loop.
Powered by blists - more mailing lists