On Mon, Jul 21, 2025 at 11:18:23AM +0900, Byungchul Park wrote: > 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@xxxxxxxxxxxxx/ > > 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 v11: > 1. Rebase on net-next/main as of Jul 21. > 2. Change page_pool_page_is_pp() to check for const type of > page. For now that it's called along with every > pp_page_to_nmdesc() call as Pavel suggested, > page_pool_page_is_pp() should also cover const type of page. I believe the curretn version is good enough. Byungchul > Changes from v10: > 1. Introduce __netmem_to_nmdesc() and use it in > __netmem_get_pp(). (feedbacked by Mina) > 2. Fix a bug that fails on casting 'const page -> const > netmem_desc', by using macros and _Generic. (feedbacked by > test robot) > 3. Add comment on pp_page_to_nmdesc() to ask for more attention > before using the helper. (feedbacked by Mina) > > 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@xxxxxxxxx/ > 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() > netmem, 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/linux/mm.h | 4 +- > include/net/libeth/xdp.h | 2 +- > include/net/netmem.h | 153 +++++++++++++++--- > 12 files changed, 161 insertions(+), 40 deletions(-) > > > base-commit: 4701ee5044fb3992f1c910630a9673c2dc600ce5 > -- > 2.17.1