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 A8D33C83F1B for ; Mon, 14 Jul 2025 12:01:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2F2B36B009D; Mon, 14 Jul 2025 08:01:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2CA0B6B009E; Mon, 14 Jul 2025 08:01:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B8FD6B009F; Mon, 14 Jul 2025 08:01:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 079976B009D for ; Mon, 14 Jul 2025 08:01:02 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8FF0056139 for ; Mon, 14 Jul 2025 12:01:01 +0000 (UTC) X-FDA: 83662729122.24.0E69D1F Received: from invmail4.hynix.com (exvmail4.hynix.com [166.125.252.92]) by imf25.hostedemail.com (Postfix) with ESMTP id 7F427A000D for ; Mon, 14 Jul 2025 12:00:59 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; spf=pass (imf25.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=1752494459; a=rsa-sha256; cv=none; b=n9VTyHnVJj9bqJ+wL9nXX6409q+KbPiWFDn6y4B25hM7795ADuutFukcUK9A68ZB0P7Pyw 0cp2uD5e6TNk3+PDBxH/+IyD29krM/v4FERKKCUP2GPr6Y+5VU65HoYb1Mw0myX7Gfsh+i Wt5NswQaGso+KIf94iq1FRbGKZqy4o4= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; spf=pass (imf25.hostedemail.com: domain of byungchul@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=byungchul@sk.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1752494459; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=Tax/cwAcE4sXYUJ2pA/CAJ6hEfajJPpYTpoSv0qZmsA=; b=RtDxbsi7OHDeramihWAnZ6YLOVR6jYde69Q50zWFFVg3VbqLLVyjf6q5pAetcdODEEzoUY 4bpbkObt+IN6jt9OESzDjfY8IXXMO5ccFSlDS66RlC2YbqoTC4KXZMOHkucs9hUYbPpxau EUZxe5HQIrLdMgU5m7v0WjlsUbeOM7c= X-AuditID: a67dfc5b-681ff7000002311f-e8-6874f17962cc From: Byungchul Park To: willy@infradead.org, netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel_team@skhynix.com, almasrymina@google.com, ilias.apalodimas@linaro.org, harry.yoo@oracle.com, akpm@linux-foundation.org, andrew+netdev@lunn.ch, asml.silence@gmail.com, toke@redhat.com, david@redhat.com, Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org, surenb@google.com, mhocko@suse.com, linux-rdma@vger.kernel.org, bpf@vger.kernel.org, vishal.moola@gmail.com, hannes@cmpxchg.org, ziy@nvidia.com, jackmanb@google.com, wei.fang@nxp.com, shenwei.wang@nxp.com, xiaoning.wang@nxp.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com, sgoutham@marvell.com, gakula@marvell.com, sbhatta@marvell.com, hkelam@marvell.com, bbhushan2@marvell.com, tariqt@nvidia.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me, saeedm@nvidia.com, leon@kernel.org, mbloch@nvidia.com, danishanwar@ti.com, rogerq@kernel.org, nbd@nbd.name, lorenzo@kernel.org, ryder.lee@mediatek.com, shayne.chen@mediatek.com, sean.wang@mediatek.com, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, aleksander.lobakin@intel.com, horms@kernel.org, m-malladi@ti.com, krzysztof.kozlowski@linaro.org, matthias.schiffer@ew.tq-group.com, robh@kernel.org, imx@lists.linux.dev, intel-wired-lan@lists.osuosl.org, linux-arm-kernel@lists.infradead.org, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH net-next v10 00/12] Split netmem from struct page Date: Mon, 14 Jul 2025 21:00:35 +0900 Message-Id: <20250714120047.35901-1-byungchul@sk.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAAzWSa2yLcRTG/f/vdbUmb2rhRRBNBMPckyNBxqeXREJEJEam0TfarBvartuE mCli2YYh6baiZWYX0WmxotvohjGXmV06unXmkpmaWW3WDdVNfHtyfuc5zznJYQmZm5rCqpP0 ojZJoZHTElLyNfLSgrTvetWi7qdzwWy7RsOrgJWCsqFUuNrppKCxhId7DUMYzKW3EfwIvmXA fsJLQKD2MQ2XrYMEBMuzSTC/NJIwYBsm4OOjLgbq3L9JKLNvAF/RJxJcxysIqBmYBV0n62jI No4QkNdxlIbQmxEKKoO9DGQ4izFUfrnFQMPtHArODl8hoCK9M5z1voWC13fNNLw+8gpBx7UQ BZ/c4UB/sZeBnLJ8BO7qEhoyjEvBf+sHA33nagnw5cTCH5MBHlkmwmC9H8HbK80YQi4nAy86 rlNQa6vA0PQuSMBg1nkaMr+eRNCcdxfDs/PlFBTWN+HwHpuhJfQLw5lGCw3vjT4EjTVdJBQc zkFgq/JQ8N0VPnlkyEzHrhVq/N8IwdleiISbJW1Y6D71BwueqqdYuJPfzggWe7LgKI4WLrs+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OwmPDAAJ3q4+Gstx8BHUtHgZeOw108lrS6h/FxNFnQeRy9T8UGSp8TxFPy22KXC3t40i5 bR+xVy0gZ53DFDF63JjYao6yxPb/SY54e50saS+eoIndcogM2UvQpq9S5Kt2SWkavaRdtHq7 XF0WGKH2epdmDXgCVA4KJBqRjBeFZWJekZ2b1KyQIHo8ITyp44QlYsB3izYiOY+Fjhjxmr2Y mjSmC1+LFZGejyFamC92/+r/WFYIy8W8E2XUp6VzRGv9DVyI+HI0pQbFaTL06SpN2vIkXao6 O0OTlbRzT7oNRd/m/MG3JxxorOsbFxJ4pIxRwPNMdSyj0uuy011I5LEyTvG8T6uOVexSZf8o afds0+5Lk3QuNIunlTMV63+QtscKu1WZUqok7ZW0n12Kl8XnoMIm4xdcf8dmevhbb0qLY658 IkXvK9LlDppOW2b3NBwrZf5Ikl1IsLlTH343ellWqmk60GGfqi4Ir9i6ctqBeZah3K5Fnbjl y9TK5Kc79v90qWFkzY5E62hi8Od1W2KCzePck7zuOfJNq+XkVPzBYU6WsJmEzbnmu2c6/pxh bg4TJa1Tq5YswFqd6gPgoPYEMgMAAA== X-CFilter-Loop: Reflected X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 7F427A000D X-Stat-Signature: rykbyqj361jk97zuhyez18fjanzwybih X-Rspam-User: X-HE-Tag: 1752494459-225885 X-HE-Meta: U2FsdGVkX1/jXMXq1R72Exiqd51V2HU9EEDs9KOJZp6y00ShXX47jm/uosffQC8dxE9htIk074yQjc8CpoUQoaXHRW8xzPNTc39UrG88LwdOzN40SLseDmVn+c7lwQbLkT0xB5BPm73iraUxc/kTPBSZmDl/qZCX3XW5FuT7/C3t/OZRmxG7/s1UBMaM3qr37jTKrb6OlNI694YxwUPZd1MvhGo+fX+nR4JlC5PLTs30CiOGhgsx4PRrP3YjZMRerFMDI72ByH1qMIMqGn/GC3yPh/9IO/Flwcg0PiMQW4zYS4VR6M4cCG9lTMuBrZDEwaluLx4M76tfyrApdawDFAmfbGXXvmLlBB6IZhidjpndPnFqkjBCWHqHLe+a82qG9s/WgATBl8qH/tpXs2QVHemlzjJsw5XKbU3ySzKpLsfvBH2KHRi2b9zUNr3YJnGV/OXMzCD2btEahyL6Jy1lSDYHW99N5xDb4T59NJJPz6brpbLfE31Znz0yq3aJu1RAvdqwrEAxLlHMW2ZByNMTQ6rYBFs12K5B4GPWClL3PTqoAG1D2jOXN7GZxVVzdl2VRqMgDFyEmpwvIwwFRUg+BLyOvcohYWEDJME8xwkoEKyn/EVJMUuDWEub4gpulcB7T4o11W21gT/DuTSo/zz9xOvViO/62fH+TH15UnJ8uHrreNcfUaPYOP0WJqPJCUpNH2Qt7PEKRHsktxTLq/iZ7IyL+Y0DbzIqhNwYqpv+XnhgHmAv7hPDFe4CZaGPZCS8c0r+hBnrS9wwT7N3rZ4b4+uHvedZpff9SMiNrjvj065/0ycZJPsQxls6TNpZH4zvA7qy5ChQoee3hUk047eE7+omiQRg/eSHxGogBkU6AIJSTXyNSvx7i1HYB7O0W29eqwGUI4Ka4H4HelYXsblrsILbwW3CHAMz0Y1eT8fM58zxA2aL0rtNQfkkxBNgC4hnxRlKkh4NX6YSTogWjX4 sx3B3wLU Ja5amARnoo4g5MGLIHDuwfJQ+P/nS9CRpkSRiFFHaTLRwf4KZSJGyxnsQlkvd9iZVScrY1qxif1vkdWdkzHHN7fGtMvZWUC9tw7kzLU9EYafGnj+F/mu2uabZkqTNc3Am7/KbI9tbshA0iFucVn7oh3QboA== 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: Hi all, The MM subsystem is trying to reduce struct page to a single pointer. See the following link for your information: https://kernelnewbies.org/MatthewWilcox/Memdescs/Path The first step towards that is splitting struct page by its individual users, as has already been done with folio and slab. This patchset does that for page pool. Matthew Wilcox tried and stopped the same work, you can see in: https://lore.kernel.org/linux-mm/20230111042214.907030-1-willy@infradead.org/ I focused on removing the page pool members in struct page this time, not moving the allocation code of page pool from net to mm. It can be done later if needed. The final patch that removes the page pool fields will be posted once all the conversions are completed. Byungchul --- Changes from v9: 1. Remove the patch 'page_pool: access ->pp_magic through netmem_desc in page_pool_page_is_pp()' and decide to wait for Pavel's work of PageNetpp() to identify page type for page pool, that doesn't need to access ->pp_magic. 2. Rename page_to_nmdesc() to pp_page_to_nmdesc() and add DEBUG_NET_WARN_ON_ONCE(!page_pool_page_is_pp(page)) in it, just in case. (feedbacked by Pavel) 3. Apply just simple casting from page to netmem_desc for accessing ->pp and ->pp_ref_count, instead of full converting page to netmem_ref for network drivers e.g. mlx4, netdevsim, and mt76. 4. Expand the support for drivers to access ->pp and ->pp_ref_count to fec, octeontx2-pf, iavf, idpf, mlx5, ti, and xdp. 5. Squash each helper with its first user. (feedbacked by Mina) Changes from v8: 1. Rebase on net-next/main as of Jul 10. 2. Exclude non-controversial patches that have already been merged to net-next. 3. Re-add the patches that focus on removing accessing the page pool fields in struct page. 4. Add utility APIs e.g. casting, to use struct netmem_desc as descriptor, to support __netmem_get_pp() that has started to be used again e.g. by libeth. Changes from v7 (no actual updates): 1. Exclude "netmem: introduce struct netmem_desc mirroring struct page" that might be controversial. 2. Exclude "netmem: introduce a netmem API, virt_to_head_netmem()" since there are no users. Changes from v6 (no actual updates): 1. Rebase on net-next/main as of Jun 25. 2. Supplement a comment describing struct net_iov. 3. Exclude a controversial patch, "page_pool: access ->pp_magic through struct netmem_desc in page_pool_page_is_pp()". 4. Exclude "netmem: remove __netmem_get_pp()" since the API started to be used again by libeth. Changes from v5 (no actual updates): 1. Rebase on net-next/main as of Jun 20. 2. Add given 'Reviewed-by's and 'Acked-by's, thanks to all. 3. Add missing cc's. Changes from v4: 1. Add given 'Reviewed-by's, thanks to all. 2. Exclude potentially controversial patches. Changes from v3: 1. Relocates ->owner and ->type of net_iov out of netmem_desc and make them be net_iov specific. 2. Remove __force when casting struct page to struct netmem_desc. Changes from v2: 1. Introduce a netmem API, virt_to_head_netmem(), and use it when it's needed. 2. Introduce struct netmem_desc as a new struct and union'ed with the existing fields in struct net_iov. 3. Make page_pool_page_is_pp() access ->pp_magic through struct netmem_desc instead of struct page. 4. Move netmem alloc APIs from include/net/netmem.h to net/core/netmem_priv.h. 5. Apply trivial feedbacks, thanks to Mina, Pavel, and Toke. 6. Add given 'Reviewed-by's, thanks to Mina. Changes from v1: 1. Rebase on net-next's main as of May 26. 2. Check checkpatch.pl, feedbacked by SJ Park. 3. Add converting of page to netmem in mt76. 4. Revert 'mlx5: use netmem descriptor and APIs for page pool' since it's on-going by Tariq Toukan. I will wait for his work to be done. 5. Revert 'page_pool: use netmem APIs to access page->pp_magic in page_pool_page_is_pp()' since we need more discussion. 6. Revert 'mm, netmem: remove the page pool members in struct page' since there are some prerequisite works to remove the page pool fields from struct page. I can submit this patch separatedly later. 7. Cancel relocating a page pool member in struct page. 8. Modify static assert for offests and size of struct netmem_desc. Changes from rfc: 1. Rebase on net-next's main branch. https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/ 2. Fix a build error reported by kernel test robot. https://lore.kernel.org/all/202505100932.uzAMBW1y-lkp@intel.com/ 3. Add given 'Reviewed-by's, thanks to Mina and Ilias. 4. Do static_assert() on the size of struct netmem_desc instead of placing place-holder in struct page, feedbacked by Matthew. 5. Do struct_group_tagged(netmem_desc) on struct net_iov instead of wholly renaming it to strcut netmem_desc, feedbacked by Mina and Pavel. Byungchul Park (12): netmem: introduce struct netmem_desc mirroring struct page netmem: use netmem_desc instead of page to access ->pp in __netmem_get_pp() mlx4: access ->pp_ref_count through netmem_desc instead of page netdevsim: access ->pp through netmem_desc instead of page mt76: access ->pp through netmem_desc instead of page net: fec: access ->pp through netmem_desc instead of page octeontx2-pf: access ->pp through netmem_desc instead of page iavf: access ->pp through netmem_desc instead of page idpf: access ->pp through netmem_desc instead of page mlx5: access ->pp through netmem_desc instead of page net: ti: icssg-prueth: access ->pp through netmem_desc instead of page libeth: xdp: access ->pp through netmem_desc instead of page drivers/net/ethernet/freescale/fec_main.c | 10 +- drivers/net/ethernet/intel/iavf/iavf_txrx.c | 2 +- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 8 +- .../marvell/octeontx2/nic/otx2_txrx.c | 2 +- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 4 +- .../net/ethernet/mellanox/mlx5/core/en/xdp.c | 3 +- .../net/ethernet/ti/icssg/icssg_prueth_sr1.c | 4 +- drivers/net/netdevsim/netdev.c | 6 +- drivers/net/wireless/mediatek/mt76/mt76.h | 3 +- include/net/libeth/xdp.h | 2 +- include/net/netmem.h | 129 +++++++++++++++--- 11 files changed, 135 insertions(+), 38 deletions(-) base-commit: c65d34296b2252897e37835d6007bbd01b255742 -- 2.17.1