From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 80BEDC4332F for ; Wed, 13 Dec 2023 11:31:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 1A93181801; Wed, 13 Dec 2023 11:31:02 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 1A93181801 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1702467062; bh=KgfUTENk/XqhMgc2eRun5EfQhwEz70TqRuDd9cBywco=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=e9fqkxd5qSfs0uMp1cBcOGc/n3W2FhlOMaHQUVPCrbGHOlWQT40r2CT373Zm5lUa/ UZwJgGoc9Pr1OEZdtxKM3xBWTVJQL3UpBPF4j/e4NZDDsEPhjQE2iOSDe7NJQ6NAqI nYTog1ShxpQSkRkto+V1kjUWCkqSOhz+bXBMNAZTt1KshMqRfXxCXVSpbQ1xKzZenN K2ZHUmt0w+XtBXbBaYnnFSmZYe9BWO9YHLr8ui1zZwf5zKr9bSC/FORyIt/ZXLMuOF Ae/y1hbTfO8GPu+ilEAKzN2Pwu9Kp30E1RNZQKacZxSOR42V+wnFSFooarXYFXzjyY RhethQhKMjtJQ== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id esITGMTkqu28; Wed, 13 Dec 2023 11:31:01 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id 18EE681865; Wed, 13 Dec 2023 11:31:01 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 18EE681865 Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id C8BFD1BF5B5 for ; Wed, 13 Dec 2023 11:30:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 9BEB9419BE for ; Wed, 13 Dec 2023 11:30:59 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 9BEB9419BE X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a06qFykSqP6O for ; Wed, 13 Dec 2023 11:30:58 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by smtp2.osuosl.org (Postfix) with ESMTPS id 8F3D841953 for ; Wed, 13 Dec 2023 11:30:58 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 8F3D841953 X-IronPort-AV: E=McAfee;i="6600,9927,10922"; a="375103870" X-IronPort-AV: E=Sophos;i="6.04,272,1695711600"; d="scan'208";a="375103870" 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 To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni 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 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702467058; x=1734003058; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ejhuq7rcREiXUDQMM5p6SxYKQOlZ+enzGd8uebPKEaM=; b=i/dtz8PSbDqgyYAVfmS7bPLuRdcm3cgN0WoUUuO4mwRR0mlSkzOHDFD6 LAzy4TGoVHdzcAymhazROWjZ0iS00/HaaUGUlICdcJ7r4lDLD9y/+2+eV zES4z9V0BMq/rvTs59sfz0N8K6cTE70KPo3XK+37R9sLuQRjlrYtcFYPl CcXctAfA3qnjPiDj3RJcRWxSgtEpYtbBYPC91c0R4A6SMx61DX8WQdK3q FFdpMcHhLODfH/JEb+Kw/BLpbVKopi2u9IKmm7sQX1z2AHAhuonkCyqPU gwQ9gKi36K7jgY1FyoFLImKJB4KB1Yeml4XrnCCJFS14s4qwdaMZdXfvm A==; X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=i/dtz8PS Subject: [Intel-wired-lan] [PATCH net-next v7 01/12] page_pool: make sure frag API fields don't span between cachelines X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Menzel , Maciej Fijalkowski , Jesper Dangaard Brouer , Larysa Zaremba , netdev@vger.kernel.org, Alexander Duyck , Ilias Apalodimas , linux-kernel@vger.kernel.org, Alexander Lobakin , Yunsheng Lin , Michal Kubiak , intel-wired-lan@lists.osuosl.org, David Christensen Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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 --- 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; -- 2.43.0 _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan