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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CF4EC54ED1 for ; Wed, 28 May 2025 01:22:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D6E2C6B0083; Tue, 27 May 2025 21:22:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D457E6B0088; Tue, 27 May 2025 21:22:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C0FA96B0089; Tue, 27 May 2025 21:22:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 9EF086B0083 for ; Tue, 27 May 2025 21:22:04 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 836D51D5EE2 for ; Wed, 28 May 2025 01:22:03 +0000 (UTC) X-FDA: 83490565326.25.ACDC7F5 Received: from invmail4.hynix.com (exvmail4.skhynix.com [166.125.252.92]) by imf04.hostedemail.com (Postfix) with ESMTP id F0D9A40007 for ; Wed, 28 May 2025 01:22:00 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf04.hostedemail.com: domain of byungchul@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=byungchul@sk.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1748395321; h=from:from:sender: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=SwLZtDoVzUYEU4whAEAViY6Zz7YzZ3NGo6Q/L+MCSvo=; b=cZs1iYyuCT7xXbGqziaoBCRC9+jK8rfmrF5W1UXGlY+7IGNYlSFVLnw5MOvvtp9c4oPN4N upSi0Au4a+kc62Ca9u6ndvgPijDFCGDRsC8XP3HYHDvORPUSxBZQepRn+3oU2cvYe2YhEP Ps1+P5iDafHQPmItCgOU+9d1PQx+1yo= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf04.hostedemail.com: domain of byungchul@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=byungchul@sk.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1748395321; a=rsa-sha256; cv=none; b=iHqGwHlKSMH/sWun4wm6t2a4kXaR2zbPk/4gGymrVKIn4aiTX0r/H65PaUdAIdKhghWrNk vtiZIV2NDAxCsuQcu70XPbQAar4XNHsUtt0X8ilmHOq9F/byfhjyYtR5MRgd3QZC3p682C 0ssb2rhZygHjr60a3eV5hUV+A8mQFss= X-AuditID: a67dfc5b-681ff7000002311f-65-6836653645ce Date: Wed, 28 May 2025 10:21:52 +0900 From: Byungchul Park To: Mina Almasry Cc: willy@infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel_team@skhynix.com, kuba@kernel.org, ilias.apalodimas@linaro.org, harry.yoo@oracle.com, hawk@kernel.org, akpm@linux-foundation.org, davem@davemloft.net, john.fastabend@gmail.com, andrew+netdev@lunn.ch, asml.silence@gmail.com, toke@redhat.com, tariqt@nvidia.com, edumazet@google.com, pabeni@redhat.com, saeedm@nvidia.com, leon@kernel.org, ast@kernel.org, daniel@iogearbox.net, david@redhat.com, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org, surenb@google.com, mhocko@suse.com, horms@kernel.org, linux-rdma@vger.kernel.org, bpf@vger.kernel.org, vishal.moola@gmail.com Subject: Re: [PATCH 01/18] netmem: introduce struct netmem_desc struct_group_tagged()'ed on struct net_iov Message-ID: <20250528012152.GA2986@system.software.com> References: <20250523032609.16334-1-byungchul@sk.com> <20250523032609.16334-2-byungchul@sk.com> <20250527025047.GA71538@system.software.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Brightmail-Tracker: H4sIAAAAAAAAA02Sa1BMYRjHvXvec/a0LMdKXkJjXcvohjwfTDJuL+MD41sMdnTYZbvMlpTB hGaMHSXE1NrMCrVy2VrpptmprUkuQ7OUza1swojQsi41Ybcx+vab5z//5/d8eHhGUchO4jUJ KaIuQaVVcjIs+ziqcF6UGKUOP18YBEbLVQ6u/EiD4s4qFowlFQi+/nwmBXfjbQ4unPcwYHyY ieGb5RcD3U0uKXQUvcFQe6SSAdfxZg6yMvsZOFRllkBLRTYLub8uMVCZ0SmFRzVGDl5e/c3C G3sWhjuGyxg6smOgyRQAnnsfEDRaKiXgOVbAwSmHiYOuzA4EjgYXhrMHsxFYbE4W+n8YuZhp tPxyu4RWG15Iqcm6m94wh1C908FQa8lRjlr7Tkrp87Zajjbn9WNaXeWW0KzDvRz90v0U00+2 Vo5aylsxvW9qlFK3deo6IVa2OE7UalJFXVj0Vpm66GsvTioNSbv4+YskA5mn6hHPE2EBab40 Ro/8fPi+uJ7xMhZmEk9DmY85YTZxOn/62F8IJhdtJ1gvM0IHSx4Yd3p5nKAlhacGsJflwiLy 3ebm9EjGK4QniLR2n0ZDwVhyJ/81HirPJgPnHIz3BkYIJMWD/NA4iBy+edbn8hPWE3tvu686 XphO6ipuS7w7iVDOkzxzATN09ERSb3biHDTWMExhGKYw/FcYhilMCJcghSYhNV6l0S4IVacn aNJCtyXGW9HfzynaP7CxCvW1bLAjgUfKUXJaulCtYFWpyenxdkR4RukvP7QkSq2Qx6nS94q6 xC263Vox2Y4CeaycII/07IlTCDtUKeIuUUwSdf9SCe83KQMtrd2e1z2zTL29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6qmrfnBmT1RB7e2+z/YHfHN7/fXks2R91dT3v0B5dnc 6T0hxfvCToZJo4KfhOJdQW/CWS/butD9bh1S4xJLhOxhVuIFn1QlY1CrNvnSeoPqL8gRMpwZ AwAA X-CFilter-Loop: Reflected X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: F0D9A40007 X-Stat-Signature: cpt3w7uymc5ahogk4dm8um38mc14dtgu X-Rspam-User: X-HE-Tag: 1748395320-437772 X-HE-Meta: U2FsdGVkX18FEVgjjAz94o50ELLzMQfDS0+8hRBQKA0fuEd1ANyexwxoe1o9CV1il/WANKBFv3wRX1XxgMvCI6aSH9e6CLFOz13wSBECCEgdjC4yY7odzGUWTmIwepV93J5zf91XvtcOUuW+MEo2sl8bpIfc1E+7aNgwqK81ptsHEnRCOGQ8+YiSfpuNNeG4wijBwg7AocUNQkTnzbWQ6aEMcWDdZVGlJD0yGbSp6/a1D19XUtWwSbWgj2LpTlsD7ih3BvCe6oWCd0om713GcJ0MhDKQQI8ewM4I6IDt6ausFocF/jae7I0u1mids89r+DO2TK5RRnhTxwabZYZ+Oe+rr3TPvfutZMR2r8vbBen0WO0GUtoCQUNi1Oh/RaecLa0tqeSBHXfO5qLbpjI/Kpc5s2aVMRj6EwrjSWVaO5RE2qO5O9KRzl+baQlckQAz1wjyOoCD2VXe7tlO8/Bgb552pbN7hCg8gooS2a/lW8N2TC31TWzozRbzjILmYgmyRVFYahxA6Xp8sBS9t7hRXVZY2ALoxtsolsppKGOhXkvIvzI6ijMs9mwfpJPGu7YxDs1TS1BMl/NnGyonAALbmWvd2VLpmkrQnT0VpTjiStDCvjbgMSFW1AB9Z3Tni78l3xEOYsez097wRZo9mWXCmhgWTbuHSAwJ72QuGdicqJHAzqQodUeyB9p/+gadpd220NXitN7QWGpYaOsXOOfQBdf3wviSshx2YdPwhRR6RXjSkobZXZKbsFBlxT7AxuIYeRm9Ful+cUL6AlorK8qr4RVuNb+hKMmNGCopiVCbeIeTrLNhvQV0HHLweTRQ8hLcgJcvQh1y8LrIYo2e5zvYqIhHsW5+VcDckgXS6IPEVaAYmM7sE16ZUnn7SqmS8phyPrIkikP6ZiCCAQQ67P818Vt1CkbIP9RNLBCKcoA7Ka4OTDrtZ0JAHcSbRAVF7zMxvoL1ujSkWkR4Ki68ziv 3mJqYe1a yx9FsxMKC7bw96mFAiIgMrKxGbqc7QFtNudVKwLBXhD2hpSIx82DXU3b56OzqwbwVaSrYrDMaHEiYVhK9OU+0FEnL/eM7+1woN2jF+sXocW4klZ52eDEliYnMLmIbPpZD3I7m7raIAT97Re4hi76sBLsyroOsByoVmKcUhC+Tr9cQkkF/d/ILFgxrVhw3FfuVWtmV5ianXC+vS8i8Ap3keYKwMHRqxfAruynwaLde3hdnlo/z6hJF+u45WsnERav1NGwGX0774K7kNJgq2unaoz9tw6SVSv5cobi9 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, May 27, 2025 at 01:03:32PM -0700, Mina Almasry wrote: > On Mon, May 26, 2025 at 7:50 PM Byungchul Park wrote: > > > > On Fri, May 23, 2025 at 12:25:52PM +0900, Byungchul Park wrote: > > > To simplify struct page, the page pool members of struct page should be > > > moved to other, allowing these members to be removed from struct page. > > > > > > Introduce a network memory descriptor to store the members, struct > > > netmem_desc, reusing struct net_iov that already mirrored struct page. > > > > > > While at it, relocate _pp_mapping_pad to group struct net_iov's fields. > > > > > > Signed-off-by: Byungchul Park > > > --- > > > include/linux/mm_types.h | 2 +- > > > include/net/netmem.h | 43 +++++++++++++++++++++++++++++++++------- > > > 2 files changed, 37 insertions(+), 8 deletions(-) > > > > > > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h > > > index 56d07edd01f9..873e820e1521 100644 > > > --- a/include/linux/mm_types.h > > > +++ b/include/linux/mm_types.h > > > @@ -120,13 +120,13 @@ struct page { > > > unsigned long private; > > > }; > > > struct { /* page_pool used by netstack */ > > > + unsigned long _pp_mapping_pad; > > > /** > > > * @pp_magic: magic value to avoid recycling non > > > * page_pool allocated pages. > > > */ > > > unsigned long pp_magic; > > > struct page_pool *pp; > > > - unsigned long _pp_mapping_pad; > > > unsigned long dma_addr; > > > atomic_long_t pp_ref_count; > > > }; > > > diff --git a/include/net/netmem.h b/include/net/netmem.h > > > index 386164fb9c18..08e9d76cdf14 100644 > > > --- a/include/net/netmem.h > > > +++ b/include/net/netmem.h > > > @@ -31,12 +31,41 @@ enum net_iov_type { > > > }; > > > > > > struct net_iov { > > > - enum net_iov_type type; > > > - unsigned long pp_magic; > > > - struct page_pool *pp; > > > - struct net_iov_area *owner; > > > - unsigned long dma_addr; > > > - atomic_long_t pp_ref_count; > > > + /* > > > + * XXX: Now that struct netmem_desc overlays on struct page, > > > + * struct_group_tagged() should cover all of them. However, > > > + * a separate struct netmem_desc should be declared and embedded, > > > + * once struct netmem_desc is no longer overlayed but it has its > > > + * own instance from slab. The final form should be: > > > + * > > > + * struct netmem_desc { > > > + * unsigned long pp_magic; > > > + * struct page_pool *pp; > > > + * unsigned long dma_addr; > > > + * atomic_long_t pp_ref_count; > > > + * }; > > > + * > > > + * struct net_iov { > > > + * enum net_iov_type type; > > > + * struct net_iov_area *owner; > > > + * struct netmem_desc; > > > + * }; > > > + */ > > > + struct_group_tagged(netmem_desc, desc, > > > > So.. For now, this is the best option we can pick. We can do all that > > you told me once struct netmem_desc has it own instance from slab. > > > > Again, it's because the page pool fields (or netmem things) from struct > > page will be gone by this series. > > > > Mina, thoughts? > > > > Can you please post an updated series with the approach you have in > mind? I think this series as-is seems broken vis-a-vie the > _pp_padding_map param move that looks incorrect. Pavel and I have also > commented on patch 18 that removing the ASSERTS seems incorrect as > it's breaking the symmetry between struct page and struct net_iov. I told you I will fix it. I will send the updated series shortly for *review*. However, it will be for review since we know this work can be completed once the next works have been done: https://lore.kernel.org/all/20250520205920.2134829-2-anthony.l.nguyen@intel.com/ https://lore.kernel.org/all/1747950086-1246773-9-git-send-email-tariqt@nvidia.com/ > It's not clear to me if the fields are being removed from struct page, > where are they going... the approach ptdesc for example has taken is They are going to struct net_iov. Or I should introduce another struct mirroring struct page as ptdesc did, that would be the exact same as struct net_iov. Do you think I should do that? > to create a mirror of struct page, then show via asserts that the > mirror is equivalent to struct page, AFAIU: > > https://elixir.bootlin.com/linux/v6.14.3/source/include/linux/mm_types.h#L437 > > Also the same approach for zpdesc: > > https://elixir.bootlin.com/linux/v6.14.3/source/mm/zpdesc.h#L29 Okay, again. Thanks. Byungchul > In this series you're removing the entries from struct page, I'm not > really sure where they went, and you're removing the asserts that we > have between net_iov and struct page so we're not even sure that those > are in sync anymore. I would suggest for me at least reposting with > the new types you have in mind and with clear asserts showing what is > meant to be in sync (and overlay) what. > > -- > Thanks, > Mina