On 30/11/2022 23.07, Matthew Wilcox (Oracle) wrote:
The MM subsystem is trying to reduce struct page to a single pointer.
The first step towards that is splitting struct page by its individual
users, as has already been done with folio and slab. This attempt chooses
'netmem' as a name, but I am not even slightly committed to that name,
and will happily use another.
I've not been able to come-up with a better name, so I'm okay with
'netmem'. Others are of-cause free to bikesheet this ;-)
There are some relatively significant reductions in kernel text
size from these changes. I'm not qualified to judge how they
might affect performance, but every call to put_page() includes
a call to compound_head(), which is now rather more complex
than it once was (at least in a distro config which enables
CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP).
I have a micro-benchmark [1][2], that I want to run on this patchset.
Reducing the asm code 'text' size is less likely to improve a
microbenchmark. The 100Gbit mlx5 driver uses page_pool, so perhaps I can
run a packet benchmark that can show the (expected) performance improvement.
[1]
https://github.com/netoptimizer/prototype-kernel/blob/master/kernel/lib/bench_page_pool_simple.c
[2]
https://github.com/netoptimizer/prototype-kernel/blob/master/kernel/lib/bench_page_pool_cross_cpu.c
I've only converted one user of the page_pool APIs to use the new netmem
APIs, all the others continue to use the page based ones.
I guess we/netdev-devels need to update the NIC drivers that uses page_pool.
Uh, I see I left netmem_to_virt() as its own commit instead of squashing
it into "netmem: Add utility functions". I'll fix that in the next
version, because I'm sure you'll want some changes anyway.
Happy to answer questions.
Matthew Wilcox (Oracle) (24):
netmem: Create new type
netmem: Add utility functions
page_pool: Add netmem_set_dma_addr() and netmem_get_dma_addr()
page_pool: Convert page_pool_release_page() to
page_pool_release_netmem()
page_pool: Start using netmem in allocation path.
page_pool: Convert page_pool_return_page() to
page_pool_return_netmem()
page_pool: Convert __page_pool_put_page() to __page_pool_put_netmem()
page_pool: Convert pp_alloc_cache to contain netmem
page_pool: Convert page_pool_defrag_page() to
page_pool_defrag_netmem()
page_pool: Convert page_pool_put_defragged_page() to netmem
page_pool: Convert page_pool_empty_ring() to use netmem
page_pool: Convert page_pool_alloc_pages() to page_pool_alloc_netmem()
page_pool: Convert page_pool_dma_sync_for_device() to take a netmem
page_pool: Convert page_pool_recycle_in_cache() to netmem
page_pool: Remove page_pool_defrag_page()
page_pool: Use netmem in page_pool_drain_frag()
page_pool: Convert page_pool_return_skb_page() to use netmem
page_pool: Convert frag_page to frag_nmem
xdp: Convert to netmem
mm: Remove page pool members from struct page
netmem_to_virt
page_pool: Pass a netmem to init_callback()
net: Add support for netmem in skb_frag
mvneta: Convert to netmem
drivers/net/ethernet/marvell/mvneta.c | 48 ++---
include/linux/mm_types.h | 22 ---
include/linux/skbuff.h | 11 ++
include/net/page_pool.h | 181 ++++++++++++++---
include/trace/events/page_pool.h | 28 +--
net/bpf/test_run.c | 4 +-
net/core/page_pool.c | 274 +++++++++++++-------------
net/core/xdp.c | 7 +-
8 files changed, 344 insertions(+), 231 deletions(-)
base-commit: 13ee7ef407cfcf63f4f047460ac5bb6ba5a3447d