Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp2865160rwp; Fri, 14 Jul 2023 12:37:17 -0700 (PDT) X-Google-Smtp-Source: APBJJlGddGmd96HlYdZefwFX152NwC42aDGSP6etez3DpvDcVlG8OhA9O7RTCJpiHOmzOrKE+FI1 X-Received: by 2002:a17:903:11cc:b0:1b9:da8b:4eac with SMTP id q12-20020a17090311cc00b001b9da8b4eacmr5282864plh.56.1689363436640; Fri, 14 Jul 2023 12:37:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689363436; cv=none; d=google.com; s=arc-20160816; b=ZU5D479cdd+cDBTy9IfLi3jMSQyBlX0t4iOZz5rrdQxpxUooUaTD4KU0PoltJEj7FF y7D6oxQUi2eaYxv6ZL347L1wDh8ZtUmKEPQgpvusWt39uvSxla+31C9FMg8kBpHaFXqW bD8sClPM/yYRwk4wqcJrtfoHtbQDqpLMsCTO+/+zZLyoNpM7yqB1U+Tf4wuiejrnlbpI pUq8LW2qxAp4E6EpJY58K8cqQEinVaQHtJy+DZwKOq/6zN35Ld8JnBMOlZVJFj5dAdPy Ef1SZ1lF0fTd7t3eRNvaveHD83afnKLQt4tza4YHa/6U42kaWOPzRT6vNiUI7Vxo2cG8 V0wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :to:content-language:subject:cc:user-agent:mime-version:date :message-id:from:dkim-signature; bh=vlt/C80WJuZUiszaR3tLxgEwAcnLKDklXFhvNucHvpc=; fh=m/PaKk7Ze7v2hatZnEBRGeqW0Cj1D95xa0FBSFZ8P2c=; b=KMGon1NoDV/skQvy2cawAwXldpnJiyF0+0jjo5RpzV8PWkATf3R8ySnS6IEFpIvLdn onwKDmhx6KbCi7dTJu3rXUlskeM2KGPqN2PWAThwKFPMiMZJwkx+lBpslr9oHaN9Xjpd +AaLAQIUdqaPj1RARKHHxhn7NrS6/NJrb40Lj/FWbmsgozAmF9caixVqCENzCelEEM+/ T+LEcxID9OHVH9KNBCXIdc9CKarqfxm3Xywn/nTCrL3CEPtDsmZRLs14XGK2+sLsDJhf d2bArkB8r8Fi8+a9T0zKzr8iPeJ9CT5Xz/SXVtUtKeU30+j+j3j6/0NBrlXdOQWhQpw/ 4CBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=e49QXlrM; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t9-20020a170902e84900b001b8a2774d8fsi8080138plg.233.2023.07.14.12.37.00; Fri, 14 Jul 2023 12:37:16 -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=@redhat.com header.s=mimecast20190719 header.b=e49QXlrM; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236578AbjGNSi3 (ORCPT + 99 others); Fri, 14 Jul 2023 14:38:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236287AbjGNSi2 (ORCPT ); Fri, 14 Jul 2023 14:38:28 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ADDD1BEB for ; Fri, 14 Jul 2023 11:37:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689359864; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vlt/C80WJuZUiszaR3tLxgEwAcnLKDklXFhvNucHvpc=; b=e49QXlrMb0tfoxyEnpH4oPJJ5ym2S8cCq8vnTfjr65YH/Mx27wxACXmxvWpoVoggi65mkI 85S4GdF5SZ2rsSqcUwC1bje1IlrrCw2Q4tWw6lq4DCKRDy8IwcSWyPtiXZrswROG41X1Or k/ZYRJ7P7u2+0Jf0YNKswmryLPoO7/w= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-655-uGfc9TreNkKbcsiWk88FbA-1; Fri, 14 Jul 2023 14:37:43 -0400 X-MC-Unique: uGfc9TreNkKbcsiWk88FbA-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2b698377ed7so21805441fa.3 for ; Fri, 14 Jul 2023 11:37:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689359862; x=1691951862; h=content-transfer-encoding:in-reply-to:references:to :content-language:subject:cc:user-agent:mime-version:date:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vlt/C80WJuZUiszaR3tLxgEwAcnLKDklXFhvNucHvpc=; b=TvfI5FgcJfquhDJIfIy5JmbTjP/U66ROTwdYLtfDWyWDQPmR4xUmkL3kovQyfUXo5h hZ3dKbWKzi/U/dP11jRAXyaCRfskE8ZGaf+VLrZrwbEfuvFAWUpr33/OTNKzCJc2T0f1 Y4S5YvaHVFxOWCrdHakp3xE7X/ObekwZZC1c7SVEZ+VuwCjiHjIyr85r5f8eStK2yoNz ixAZ2cuVmrGxGpngOzYWSDGboKvY/DMgbH5P8m3vMhAgP5PjBgMQC/ymFYRaQoWQRaK0 78A+3+w8ibR958lkS2S9HcgbanYA6Hb+UmglvtRJNbbu2plIWscn7aExXS2Wd+ewinTB FZPw== X-Gm-Message-State: ABy/qLb6qyH++vgO2Iere5pcuIAvVtlvP2u1SornnpXZqFWj+WBNnKM4 Ujk+oXta5YNotHZv9vdbvd5tD8BpeN3LomDvf0ROmgWpI8bHA+cVCKMBk8KQOFvd/07Rqc/skEG C/hewJW9XGv2/QPKdrNh4wo03 X-Received: by 2002:a2e:9053:0:b0:2b5:9e51:2912 with SMTP id n19-20020a2e9053000000b002b59e512912mr4824484ljg.24.1689359861978; Fri, 14 Jul 2023 11:37:41 -0700 (PDT) X-Received: by 2002:a2e:9053:0:b0:2b5:9e51:2912 with SMTP id n19-20020a2e9053000000b002b59e512912mr4824471ljg.24.1689359861658; Fri, 14 Jul 2023 11:37:41 -0700 (PDT) Received: from [192.168.42.100] (194-45-78-10.static.kviknet.net. [194.45.78.10]) by smtp.gmail.com with ESMTPSA id b8-20020a170906038800b009893650453fsm5726448eja.173.2023.07.14.11.37.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Jul 2023 11:37:41 -0700 (PDT) From: Jesper Dangaard Brouer X-Google-Original-From: Jesper Dangaard Brouer Message-ID: Date: Fri, 14 Jul 2023 20:37:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Cc: brouer@redhat.com, Maciej Fijalkowski , Larysa Zaremba , Yunsheng Lin , Alexander Duyck , Jesper Dangaard Brouer , Ilias Apalodimas , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC net-next v2 2/7] net: page_pool: place frag_* fields in one cacheline Content-Language: en-US To: Alexander Lobakin , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni References: <20230714170853.866018-1-aleksander.lobakin@intel.com> <20230714170853.866018-3-aleksander.lobakin@intel.com> In-Reply-To: <20230714170853.866018-3-aleksander.lobakin@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 14/07/2023 19.08, Alexander Lobakin wrote: > 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; I think this is okay, but I want to highlight that: - pages_state_hold_cnt and pages_state_release_cnt need to be kept on separate cache-lines. > + > 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;