Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp2721164rwp; Fri, 14 Jul 2023 10:13:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlHoliVYnPyRS7Mttf3PcSPwiRg1ELaqehuj5gwKy6nEzW4V+RzHYSI//xHdFtEcaS620Di7 X-Received: by 2002:a17:902:cec3:b0:1b8:b26f:a6ac with SMTP id d3-20020a170902cec300b001b8b26fa6acmr4739204plg.5.1689354813217; Fri, 14 Jul 2023 10:13:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689354813; cv=none; d=google.com; s=arc-20160816; b=JG+nNycqFdzfpoTXIkSoA27yQq4fbKj24FURrUvkRtpxNjQK9Zo1Z7F40kc2Ltt/rx 4hVbvIdd4TE5EWZ5ZCggpwFJDGrHSkzMsqT9q78NX+V+aiqi5nmNpcfxAsaAbpBFXIf0 4Yk3g7kITLjfibG9elBDnwNdTVu7sHxhTWUr4WA/BCowvtkMH7s600PqfLvJUylI8fDY zH8TSRSI5IlpmJ5CKhPQR6txQKpB0pc36BP7aA3jnAG1+zNvO6t9uCclh9jkxg+uV89L 7iKCN5zuBmp6pxIrzfxSKjaPT8lTe9NytMgjm3kV/3WN5qXjMdk27cVFMg/0sEfeRsfd Udcg== 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=D9PlBjT4L5AMebzl8VhXzZ1DxmYJrXaCh192pcCcX1w=; fh=A5BPnNIfRqU38T74SnJN3mZ6ktDaFB2zVWcmAifDomI=; b=Nb7wqJmksONRMfF8Bpvb1nT0kWMXKjBMI46fD1bteg45s1dKsU9Qk83tv/zkFQ8jlq X7P9O8CKWXxk1x0T7+bPYvaPMuIexSKGfRXbPmESBT2GUiKmaeehznAeRjDBFCnbSR9K S+9Ht4MARWzsvgv3YEypghTqJDPPF4qwyWNbgGzsVxKpQxydfLvYoC/Pu1AVdPnLymZK LcVnI1lgxHeE0JJxIlxkX3xTpoF1M3oljDYwsGg7RJkJZ2CXcOyyDnMgyQfJuJfrwHac eOOsBVWfJY/rSQFA6rVkY0LIRuA9qjpjAFPLfqgtrUteNRJlTYczwDRCWXiQXZG3xry9 NQPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kYDRqYPk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l3-20020a170902f68300b001b9e3be3504si7725624plg.579.2023.07.14.10.13.21; Fri, 14 Jul 2023 10:13:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kYDRqYPk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236008AbjGNRKc (ORCPT + 99 others); Fri, 14 Jul 2023 13:10:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235235AbjGNRK2 (ORCPT ); Fri, 14 Jul 2023 13:10:28 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8EF0212B; Fri, 14 Jul 2023 10:10:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689354627; x=1720890627; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7p8mJB+ijeu7RaDZDF4ve84o/baC+2XSnWBRqZcf5LE=; b=kYDRqYPk6eMCWSeS7o4NMxIxqG8G2WyGCYYtEWj/Fu9Hq1C9k0z/VFqe JeQz4G95014EMVsp++8gWcwrvum9sAdd5quMBsJVURJrFmkf5VfBaOTtS 6ngwWTna8kcaYKSJPnzDl8yRcLQm8MhicXM+mQseB6ufNNXxyHmubm2OO 9N8LqPYPE8ssWbbR5aRbPaCE4/bMtK3oOXOQmdPu/Pf2KalHP2Vb7lFmB m9ozelMGKfl+ll/EnB12mtmWPuiZYcJgE5CU0Ul7vLvwyTytntZlAAHJM wJPv+Isz6pGv6qwEmBtMU1GY72yt01zizbb1fQye0sWiyAqWIU47YmKeT A==; X-IronPort-AV: E=McAfee;i="6600,9927,10771"; a="451891846" X-IronPort-AV: E=Sophos;i="6.01,206,1684825200"; d="scan'208";a="451891846" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2023 10:10:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10771"; a="787907004" X-IronPort-AV: E=Sophos;i="6.01,206,1684825200"; d="scan'208";a="787907004" Received: from newjersey.igk.intel.com ([10.102.20.203]) by fmsmga008.fm.intel.com with ESMTP; 14 Jul 2023 10:10:24 -0700 From: Alexander Lobakin To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Alexander Lobakin , Maciej Fijalkowski , Larysa Zaremba , Yunsheng Lin , Alexander Duyck , Jesper Dangaard Brouer , Ilias Apalodimas , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RFC net-next v2 2/7] net: page_pool: place frag_* fields in one cacheline Date: Fri, 14 Jul 2023 19:08:45 +0200 Message-ID: <20230714170853.866018-3-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230714170853.866018-1-aleksander.lobakin@intel.com> References: <20230714170853.866018-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,URIBL_BLOCKED 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: X-Mailing-List: linux-kernel@vger.kernel.org On x86_64, frag_* fields of struct page_pool are scattered across two cachelines despite the summary size of 24 bytes. The last field, ::frag_users, is pushed out to the next one, sharing it with ::alloc_stats. All three fields are used in pretty much the same places. There are some holes and cold members to move around. Move frag_* one block up, placing them right after &page_pool_params perfectly at the beginning of CL2. This doesn't do any meaningful to the second block, as those are some destroy-path cold structures, and doesn't do anything to ::alloc_stats, which still starts at 200-byte offset, 8 bytes after CL3 (still fitting into 1 cacheline). On my setup, this yields 1-2% of Mpps when using PP frags actively. When it comes to 32-bit architectures with 32-byte CL: &page_pool_params plus ::pad is 44 bytes, the block taken care of is 16 bytes within one CL, so there should be at least no regressions from the actual change. Signed-off-by: Alexander Lobakin --- include/net/page_pool.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/net/page_pool.h b/include/net/page_pool.h index 829dc1f8ba6b..212d72b5cfec 100644 --- a/include/net/page_pool.h +++ b/include/net/page_pool.h @@ -130,16 +130,16 @@ static inline u64 *page_pool_ethtool_stats_get(u64 *data, void *stats) struct page_pool { struct page_pool_params p; + long frag_users; + struct page *frag_page; + unsigned int frag_offset; + u32 pages_state_hold_cnt; + struct delayed_work release_dw; void (*disconnect)(void *); unsigned long defer_start; unsigned long defer_warn; - u32 pages_state_hold_cnt; - unsigned int frag_offset; - struct page *frag_page; - long frag_users; - #ifdef CONFIG_PAGE_POOL_STATS /* these stats are incremented while in softirq context */ struct page_pool_alloc_stats alloc_stats; -- 2.41.0