Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2907021pxb; Tue, 12 Jan 2021 01:16:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJyxqqaed4vQ+Jz1z6EtzrrJU9zHkEth8KATdBWm5o5LqMlz8SPV2PmNC59XQubcshxu4XXr X-Received: by 2002:a17:906:589:: with SMTP id 9mr2591040ejn.229.1610442976538; Tue, 12 Jan 2021 01:16:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610442976; cv=none; d=google.com; s=arc-20160816; b=tNTREAqOdqAOj6+536GzqQ2XMZLCrLGRjER27elJ8MHIEIra5LFfcxKhjWTJ/tkipn 1qOQcY6BZ2PovgeO0/Wc8Tik/tYt7l6BdY4HlsgZaCikIIEU3nXVDsIlubJkT+0QL9uh 2GB3uqmmHNNImsIWKOKbj/OxvctGet4CwJJNS8Q516xE9FrBXuUFLs7OIN1dT6HkB3uN CJuLoOQTMroGNZ6wRXLndAI9zNIzl+w60ReOuJA2c2mZq6wfNzDas1y2sDLMTNETgQbd cF8ykfodhH+QXyg6OjJpCaeku7vhqcS3n0xl3JkU4x+qwTphkmL6KIOxpWARoTk28adQ taAg== 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=gXXU1styr81EC3F2Bwbxq+s5c4Q77ESXBToxUwsCrQs=; b=rNmhA9vM74udYlBWz+8PoVGFtd+4Ksjy+UhynUZJMfNk9isYC/4kNYLzvuv7rATCDc dsrTlMJP51IF3PDRVnJOC2C1/BOEgOmhezITw7GLIcGM9Oa6p6paf4Lxy+NuJwXt8lhg JNYMptRehU+nBrMIAQPxZD0Se/wuVuUcEPUFZApoufxJU8NSthyNKiwPSA+4XKlLpTNu nQSdYKwrO3xOQo4OrWbJuc30Tlxhv3tBZ/FGq/qsVkYNgomL75h+mpNZxtxhzlMxIN65 4t0u2wEDfrBmM1NPxB0s3O7tvWlODhusQHi7GoVaSC7AcMDniA3owykNy40FRQYVu44K O9Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=RGkKbnVP; 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 b4si871933ejv.71.2021.01.12.01.15.53; Tue, 12 Jan 2021 01:16:16 -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=RGkKbnVP; 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 S2390435AbhAKS3K (ORCPT + 99 others); Mon, 11 Jan 2021 13:29:10 -0500 Received: from mail-40136.protonmail.ch ([185.70.40.136]:20076 "EHLO mail-40136.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389472AbhAKS3K (ORCPT ); Mon, 11 Jan 2021 13:29:10 -0500 Date: Mon, 11 Jan 2021 18:28:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1610389706; bh=gXXU1styr81EC3F2Bwbxq+s5c4Q77ESXBToxUwsCrQs=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=RGkKbnVP8ThOFM7803+38qDOY3bT36OdUxsDpI0RmrxKBowzL+X+fiZ4rBoS7dhL8 mBVt/UmLpRuEWsHnfofnzXQc99P33fa+1PzRr8LmmMA16Q+H11RfCY/T6jf+z6SFw8 BtT79uC4U2tXtY01x8GPv3Qk5ItKb3p9AEECxUumKMB+o5rvFF1wjEe2pppSbmLwrS B08FYcU7Uk0uBciwT5Qx7N943xzLW2vx4suxQ5ZNElFZtO2ebZVR0CdVRwpy1Gm5tn dvexlp53KIKtkso+1kjdGTh3PSkNjCFhyBvgtjx9Ipvy0y+c7QJu+Rkkq40E5Imm/f AGGzlloiDMUaw== To: "David S. Miller" , Jakub Kicinski From: Alexander Lobakin Cc: Eric Dumazet , Edward Cree , Jonathan Lemon , Willem de Bruijn , Miaohe Lin , Alexander Lobakin , Steffen Klassert , Guillaume Nault , Yadu Kishore , Al Viro , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH net-next 1/5] skbuff: rename fields of struct napi_alloc_cache to be more intuitive Message-ID: <20210111182801.12609-1-alobakin@pm.me> In-Reply-To: <20210111182655.12159-1-alobakin@pm.me> References: <20210111182655.12159-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 skb_cache and skb_count fields are used to store skbuff_heads queued for freeing to flush them by bulks, and aren't related to allocation path. Give them more obvious names to improve code understanding and allow to expand this struct with more allocation-related elements. Misc: indent struct napi_alloc_cache declaration for better reading. Signed-off-by: Alexander Lobakin --- net/core/skbuff.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 7626a33cce59..17ae5e90f103 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -366,9 +366,9 @@ EXPORT_SYMBOL(build_skb_around); #define NAPI_SKB_CACHE_SIZE=0964 =20 struct napi_alloc_cache { -=09struct page_frag_cache page; -=09unsigned int skb_count; -=09void *skb_cache[NAPI_SKB_CACHE_SIZE]; +=09struct page_frag_cache=09page; +=09u32=09=09=09flush_skb_count; +=09void=09=09=09*flush_skb_cache[NAPI_SKB_CACHE_SIZE]; }; =20 static DEFINE_PER_CPU(struct page_frag_cache, netdev_alloc_cache); @@ -860,11 +860,11 @@ void __kfree_skb_flush(void) { =09struct napi_alloc_cache *nc =3D this_cpu_ptr(&napi_alloc_cache); =20 -=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/* flush flush_skb_cache if containing objects */ +=09if (nc->flush_skb_count) { +=09=09kmem_cache_free_bulk(skbuff_head_cache, nc->flush_skb_count, +=09=09=09=09 nc->flush_skb_cache); +=09=09nc->flush_skb_count =3D 0; =09} } =20 @@ -876,18 +876,18 @@ static inline void _kfree_skb_defer(struct sk_buff *s= kb) =09skb_release_all(skb); =20 =09/* record skb to CPU local list */ -=09nc->skb_cache[nc->skb_count++] =3D skb; +=09nc->flush_skb_cache[nc->flush_skb_count++] =3D skb; =20 #ifdef CONFIG_SLUB =09/* SLUB writes into objects when freeing */ =09prefetchw(skb); #endif =20 -=09/* flush skb_cache if it is filled */ -=09if (unlikely(nc->skb_count =3D=3D NAPI_SKB_CACHE_SIZE)) { +=09/* flush flush_skb_cache if it is filled */ +=09if (unlikely(nc->flush_skb_count =3D=3D NAPI_SKB_CACHE_SIZE)) { =09=09kmem_cache_free_bulk(skbuff_head_cache, NAPI_SKB_CACHE_SIZE, -=09=09=09=09 nc->skb_cache); -=09=09nc->skb_count =3D 0; +=09=09=09=09 nc->flush_skb_cache); +=09=09nc->flush_skb_count =3D 0; =09} } void __kfree_skb_defer(struct sk_buff *skb) --=20 2.30.0