[net-next,v7,01/12] page_pool: make sure frag API fields don't span between cachelines
Message ID | 20231213112835.2262651-2-aleksander.lobakin@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp7705387dys; Wed, 13 Dec 2023 03:31:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IHbqhxXmf0llG78HyPBNDX3Tc3kpwxUA19Dx8dofMmcUMSeYr+Zs+OVp17wQQErRKdadVkQ X-Received: by 2002:a05:6e02:188d:b0:35d:5995:7990 with SMTP id o13-20020a056e02188d00b0035d59957990mr13417651ilu.42.1702467068089; Wed, 13 Dec 2023 03:31:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702467068; cv=none; d=google.com; s=arc-20160816; b=APnLoavCKbJlW3ahjvR2vmkT0qr++eADHvdFbMkklHgjuwqW5e+vJ6uAbuQwC7EExM 7uXIApFiCHwbeMJ0IlPmJv6viYUe5EJ9l8atobSfAJWAeIbHSQ1Rs5iHccwobgJrFDjV njm7gXtrFv7cQqJ9JidbFCH8DUoTm4W49UzzgFQqIAeLYMH5b8qnqXelCSoRUSKggiRD glUQUHRtFBec5JeqL2GOQa4w57x4ZAzRThr7wKjNiCl6/KoPZpY9A3nlNUIsH9MnUYGh kiVC7nIYwgHoPriGWC1uUOm5jMPOzR3tSTjEcxYPoTBFK2RsyknB7FzAMDbsOmk+uXmn 11tA== 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:date:subject:cc:to:from :dkim-signature; bh=Q6ZsmJEdSM6251aQ9oxsdbSfcq4o2GMajJBTFQ4XqUo=; fh=QtEizEezWMPccSW0U8o1LFLT1SqErEb68UiNokAWV6o=; b=buGLk3Gqlhux8s5oyqgIBkqPaElhySi49xwe4mnbwp8wg1HrEb52mqIrqV4iZtlLNJ mXDAg9bPsaxlVXAX9mRhXT3cS97pkjeA5u9bAmT0XEH3xdpaAibOAAidgn7NvQy7YJx+ UlWm5OwNKkRPKgiqA8xH6KMXawR4XWkGatLlpT9xHN0fvMVJdF+AR4qifwHHn4+cjBkM Y6ffyytAx0d9/aGNtjkK2J9gAkAoJBlHdchQ41sNOtUmQpzHIkxWqhwneAw+ylPPJX7A r0Del+bQY67fr2q9sn+Cyia7NjjlBYMrTsYiuOzpa8mrKgN7wh9WqIsyf09g3cf3YLsw fw4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ceazthkJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id k17-20020a170902c41100b001cfe100a99fsi9730514plk.487.2023.12.13.03.31.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 03:31:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ceazthkJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 1A1A180C034D; Wed, 13 Dec 2023 03:31:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377447AbjLMLa4 (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Wed, 13 Dec 2023 06:30:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233087AbjLMLaw (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 13 Dec 2023 06:30:52 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E303B0; Wed, 13 Dec 2023 03:30:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702467059; x=1734003059; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ejhuq7rcREiXUDQMM5p6SxYKQOlZ+enzGd8uebPKEaM=; b=ceazthkJnUP2uIT088e7hGeD2jKMjCVtwc3dejKcbnHuTrRzgsi3YEtc MA82scXc09MN5YkaltgdWG1BJYUb3yebM7gIxPh6vs53HVK3Mm+SBdLCZ WyZJf7YgXoqCcyu8zSzBjeMVs/sKOSiVnZGleHlgPKMIpRJ+Pwi5IrK8u onh6WBU2TqIW8bWt4FHsO4f7wixpmXlIotodOSuZHQg1YtyvtA2seQUxJ rbJFtcR+wQHY6l7XIWGoMrXcrS3GgBw6GIPBEQmxyXC6W4Xb9Wl1XXvQZ Lav9juwPP88RDZXuER4o5o30xH3KaTEc6mH6qlW2E8FjWpsOUqiZ8epks g==; X-IronPort-AV: E=McAfee;i="6600,9927,10922"; a="375103865" X-IronPort-AV: E=Sophos;i="6.04,272,1695711600"; d="scan'208";a="375103865" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2023 03:30:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10922"; a="844279422" X-IronPort-AV: E=Sophos;i="6.04,272,1695711600"; d="scan'208";a="844279422" Received: from newjersey.igk.intel.com ([10.102.20.203]) by fmsmga004.fm.intel.com with ESMTP; 13 Dec 2023 03:30:40 -0800 From: Alexander Lobakin <aleksander.lobakin@intel.com> To: "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com> Cc: Alexander Lobakin <aleksander.lobakin@intel.com>, Maciej Fijalkowski <maciej.fijalkowski@intel.com>, Michal Kubiak <michal.kubiak@intel.com>, Larysa Zaremba <larysa.zaremba@intel.com>, Alexander Duyck <alexanderduyck@fb.com>, Yunsheng Lin <linyunsheng@huawei.com>, David Christensen <drc@linux.vnet.ibm.com>, Jesper Dangaard Brouer <hawk@kernel.org>, Ilias Apalodimas <ilias.apalodimas@linaro.org>, Paul Menzel <pmenzel@molgen.mpg.de>, netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v7 01/12] page_pool: make sure frag API fields don't span between cachelines Date: Wed, 13 Dec 2023 12:28:24 +0100 Message-ID: <20231213112835.2262651-2-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231213112835.2262651-1-aleksander.lobakin@intel.com> References: <20231213112835.2262651-1-aleksander.lobakin@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 13 Dec 2023 03:31:07 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785166108476509838 X-GMAIL-MSGID: 1785166108476509838 |
Series |
net: intel: start The Great Code Dedup + Page Pool for iavf
|
|
Commit Message
Alexander Lobakin
Dec. 13, 2023, 11:28 a.m. UTC
After commit 5027ec19f104 ("net: page_pool: split the page_pool_params
into fast and slow") that made &page_pool contain only "hot" params at
the start, cacheline boundary chops frag API fields group in the middle
again.
To not bother with this each time fast params get expanded or shrunk,
let's just align them to `4 * sizeof(long)`, the closest upper pow-2 to
their actual size (2 longs + 2 ints). This ensures 16-byte alignment for
the 32-bit architectures and 32-byte alignment for the 64-bit ones,
excluding unnecessary false-sharing.
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
---
include/net/page_pool/types.h | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/include/net/page_pool/types.h b/include/net/page_pool/types.h index ac286ea8ce2d..35ab82da7f2a 100644 --- a/include/net/page_pool/types.h +++ b/include/net/page_pool/types.h @@ -130,7 +130,16 @@ struct page_pool { bool has_init_callback; - long frag_users; + /* The following block must stay within one cacheline. On 32-bit + * systems, sizeof(long) == sizeof(int), so that the block size is + * precisely ``4 * sizeof(long)``. On 64-bit systems, the actual size + * is ``2 * sizeof(long) + 2 * sizeof(int)``, i.e. 24 bytes, but the + * closest pow-2 to that is 32 bytes, which also equals to + * ``4 * sizeof(long)``, so just use that one for simplicity. + * Having it aligned to a cacheline boundary may be excessive and + * doesn't bring any good. + */ + long frag_users __aligned(4 * sizeof(long)); struct page *frag_page; unsigned int frag_offset; u32 pages_state_hold_cnt;