Re: [PATCH 18/18] mm, netmem: remove the page pool members in struct page

From
Byungchul Park <byungchul@sk.com>
Date
2025-05-27 01:31:22
Also in
bpf, linux-mm, linux-rdma, lkml
Reply to
Byungchul Park, 2025-05-27
On Tue, May 27, 2025 at 10:02:26AM +0900, Byungchul Park wrote:
On Mon, May 26, 2025 at 05:58:10PM +0100, Pavel Begunkov wrote:
quoted
struct net_iov {
	unsigned long flags_padding;
	union {
		struct {
			// same layout as in page + build asserts;
			...
			struct page_pool *pp;
			...
		};
		struct netmem_desc desc;
	};
};

struct netmem_desc *page_to_netmem_desc(struct page *page)
{
	return &page->netmem_desc;
page will not have any netmem things in it after this, that matters.
						   ^
						   this patch series
	Byungchul
quoted
}

struct netmem_desc *netmem_to_desc(netmem_t netmem)
{
	if (netmem_is_page(netmem))
		return page_to_netmem_desc(netmem_to_page(netmem);
	return &netmem_to_niov(netmem)->desc;
}

The compiler should be able to optimise the branch in netmem_to_desc(),
but we might need to help it a bit.


Then, patch 2 ... N convert page pool and everyone else accessing
those page fields directly to netmem_to_desc / etc.

And the final patch replaces the struct group in the page with a
new field:

struct netmem_desc {
	struct page_pool *pp;
	...
};

struct page {
	unsigned long flags_padding;
	union {
		struct netmem_desc desc;
		^
		should be gone.

	Byungchul
quoted
		...
	};
};

net_iov will drop its union in a later series to avoid conflicts.

btw, I don't think you need to convert page pool to netmem for this
to happen, so that can be done in a separate unrelated series. It's
18 patches, and netdev usually requires it to be no more than 15.

-- 
Pavel Begunkov
Thread (72 messages) 72 messages, 7 authors, last reply 2025-05-28
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help