# 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 
- List: netdev
- Page: https://ratatoskr.run/netdev/2025/05/3069707
- Thread: https://ratatoskr.run/netdev/2025/05/3066805/t.md

```text
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:
> > 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
> 
> > }
> > 
> > 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
> > 		...
> > 	};
> > };
> > 
> > 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
```
