From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: [PATCH net-next 0/2] inet: factorize sk_wmem_alloc updates Date: Sat, 31 Mar 2018 13:16:24 -0700 Message-ID: <20180331201626.186789-1-edumazet@google.com> Cc: netdev , Eric Dumazet , Eric Dumazet To: "David S . Miller" Return-path: Received: from mail-pg0-f66.google.com ([74.125.83.66]:41762 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750903AbeCaUQd (ORCPT ); Sat, 31 Mar 2018 16:16:33 -0400 Received: by mail-pg0-f66.google.com with SMTP id t10so7019102pgv.8 for ; Sat, 31 Mar 2018 13:16:33 -0700 (PDT) Sender: netdev-owner@vger.kernel.org List-ID: While testing my inet defrag changes, I found that senders could spend ~20% of cpu cycles in skb_set_owner_w() updating sk->sk_wmem_alloc for every fragment they cook, competing with TX completion of prior skbs possibly happening on another cpus. One solution to this problem is to use alloc_skb() instead of sock_wmalloc() and manually perform a single sk_wmem_alloc change. This greatly increases speed for applications sending big UDP datagrams. Eric Dumazet (2): ipv4: factorize sk_wmem_alloc updates done by __ip_append_data() ipv6: factorize sk_wmem_alloc updates done by __ip6_append_data() net/ipv4/ip_output.c | 17 ++++++++++++----- net/ipv6/ip6_output.c | 17 ++++++++++++----- 2 files changed, 24 insertions(+), 10 deletions(-) -- 2.17.0.rc1.321.gba9d0f2565-goog