Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3696594pxb; Sat, 13 Feb 2021 06:18:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/P1f132Q2S4a8zXQYyIY54W/OlPQ0mFzbpnBxFccEusol3sl4fwdThevKItFIrv4fXyDa X-Received: by 2002:a17:907:2d93:: with SMTP id gt19mr7545355ejc.246.1613225939635; Sat, 13 Feb 2021 06:18:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613225939; cv=none; d=google.com; s=arc-20160816; b=AP+XBOuxfekK5TcHq6Ac2YhT4ccRzl8T2OvYa9ZKN7USwsicZHIiH+rJOltGjybeA3 nraqCtzCce1Sp2GUsjy3tbAEiwHCOXZcAju34wH2qoQhpyvVIKSlP/4qne1vJg2opNwp wyjpkzHRYcHxyYhQrW7h0vyNxCJOBK3vGZThK3arFQsmgWGHLNWccIALLP2f8/ta2FjX 2UN0wDhw7VebAoimJFVsOztw1qptf8e0ud7H9SHUGeNcEfBN6OIJ5E31XC9TGNLXCi2/ DQDuSwn4oKznUI0qjqY34TyIDdvS/hbsK9sKoAiGhEOoE2iM2ZPRE/sMCHt3E8yfqTHg 02qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:reply-to:cc:from:to :dkim-signature:date; bh=I5pt5vkO/t2xyU4szHrXQYlrL2EpJSlwZyjNhq3SMbc=; b=ZmbWBPWeinSLAL68R/gdGbYa3z5TKdSzC6NFAoqWb1wV6xLh+Zz1UrWpzqkdZkrsHq W6zP8KWbg4HbKmcR/yT5XWvussgj/ak9vYM3UBFo4hlhetTqINFJKx8E/qSlubg5SpXe 7WsJKKG9pACC9FmOBjY5ApACSaBzsRPYnueSXbaDArh8gkbvLEV8Ock72VCPCmPhoyoJ 5Ybq0WB32iTlqoivseC0ascWEmavFvgSvlafQbBIY16n4Tc3inxN9hagLYVq0LFU138o S8CSA53p1XVUZLl3Tkz6CV5KurLatioGdAvTW14w98WX42dWhgHw+UUpLdEMm0UrhKlv CySA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=RNeDa1X1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cy13si8297154edb.299.2021.02.13.06.18.35; Sat, 13 Feb 2021 06:18:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=RNeDa1X1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229930AbhBMONw (ORCPT + 99 others); Sat, 13 Feb 2021 09:13:52 -0500 Received: from mail-40134.protonmail.ch ([185.70.40.134]:50041 "EHLO mail-40134.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229832AbhBMOMt (ORCPT ); Sat, 13 Feb 2021 09:12:49 -0500 Date: Sat, 13 Feb 2021 14:12:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1613225526; bh=I5pt5vkO/t2xyU4szHrXQYlrL2EpJSlwZyjNhq3SMbc=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=RNeDa1X1LbgFaylLgkmzQQSNfTo43sDqt1PI8rAVAULG679x9oEWroUGZaA1rAEbI trWOl56Ihh+RoYKufiVCu0+9OAO+3WXTqQfFk+S2ItAU35WQS4UpuGTLtg5GJPzaE9 IfN7f2mSrW80zh/R7O1ZZa3C4riDkyG7MieC2mAq61MWz4GZ7HutLMKo0uwcLM5J7J kFjWJdcKhVjoLMsZcBJCTSWj4FZ/hSpO+KickuxLtNDdl2izkF/4y6HTuXPQbrWHHz N0U2woiwnY77I5DCupqn9/FMVr/okW3ipsmOWVUKkOlFqPY8HC7fwAQxYpet5K8ShG UyL62Nx10ooxQ== To: "David S. Miller" , Jakub Kicinski From: Alexander Lobakin Cc: Jonathan Lemon , Eric Dumazet , Dmitry Vyukov , Willem de Bruijn , Alexander Lobakin , Randy Dunlap , Kevin Hao , Pablo Neira Ayuso , Jakub Sitnicki , Marco Elver , Dexuan Cui , Paolo Abeni , Jesper Dangaard Brouer , Alexander Duyck , Alexander Duyck , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Taehee Yoo , Wei Wang , Cong Wang , =?utf-8?Q?Bj=C3=B6rn_T=C3=B6pel?= , Miaohe Lin , Guillaume Nault , Florian Westphal , Edward Cree , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH v6 net-next 06/11] skbuff: remove __kfree_skb_flush() Message-ID: <20210213141021.87840-7-alobakin@pm.me> In-Reply-To: <20210213141021.87840-1-alobakin@pm.me> References: <20210213141021.87840-1-alobakin@pm.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This function isn't much needed as NAPI skb queue gets bulk-freed anyway when there's no more room, and even may reduce the efficiency of bulk operations. It will be even less needed after reusing skb cache on allocation path, so remove it and this way lighten network softirqs a bit. Suggested-by: Eric Dumazet Signed-off-by: Alexander Lobakin --- include/linux/skbuff.h | 1 - net/core/dev.c | 7 +------ net/core/skbuff.c | 12 ------------ 3 files changed, 1 insertion(+), 19 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 0a4e91a2f873..0e0707296098 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -2919,7 +2919,6 @@ static inline struct sk_buff *napi_alloc_skb(struct n= api_struct *napi, } void napi_consume_skb(struct sk_buff *skb, int budget); =20 -void __kfree_skb_flush(void); void __kfree_skb_defer(struct sk_buff *skb); =20 /** diff --git a/net/core/dev.c b/net/core/dev.c index ce6291bc2e16..631807c196ad 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -4944,8 +4944,6 @@ static __latent_entropy void net_tx_action(struct sof= tirq_action *h) =09=09=09else =09=09=09=09__kfree_skb_defer(skb); =09=09} - -=09=09__kfree_skb_flush(); =09} =20 =09if (sd->output_queue) { @@ -7012,7 +7010,6 @@ static int napi_threaded_poll(void *data) =09=09=09__napi_poll(napi, &repoll); =09=09=09netpoll_poll_unlock(have); =20 -=09=09=09__kfree_skb_flush(); =09=09=09local_bh_enable(); =20 =09=09=09if (!repoll) @@ -7042,7 +7039,7 @@ static __latent_entropy void net_rx_action(struct sof= tirq_action *h) =20 =09=09if (list_empty(&list)) { =09=09=09if (!sd_has_rps_ipi_waiting(sd) && list_empty(&repoll)) -=09=09=09=09goto out; +=09=09=09=09return; =09=09=09break; =09=09} =20 @@ -7069,8 +7066,6 @@ static __latent_entropy void net_rx_action(struct sof= tirq_action *h) =09=09__raise_softirq_irqoff(NET_RX_SOFTIRQ); =20 =09net_rps_action_and_irq_enable(sd); -out: -=09__kfree_skb_flush(); } =20 struct netdev_adjacent { diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 1c6f6ef70339..4be2bb969535 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -838,18 +838,6 @@ void __consume_stateless_skb(struct sk_buff *skb) =09kfree_skbmem(skb); } =20 -void __kfree_skb_flush(void) -{ -=09struct napi_alloc_cache *nc =3D this_cpu_ptr(&napi_alloc_cache); - -=09/* flush skb_cache if containing objects */ -=09if (nc->skb_count) { -=09=09kmem_cache_free_bulk(skbuff_head_cache, nc->skb_count, -=09=09=09=09 nc->skb_cache); -=09=09nc->skb_count =3D 0; -=09} -} - static inline void _kfree_skb_defer(struct sk_buff *skb) { =09struct napi_alloc_cache *nc =3D this_cpu_ptr(&napi_alloc_cache); --=20 2.30.1