# Re: \[RFC 19/19\] mm, netmem: remove the page pool members in struct page

- From: Mina Almasry \<hidden\>
- Date: 2025-05-09 19:04:50 
- List: netdev
- Page: https://ratatoskr.run/netdev/2025/05/3049677
- Thread: https://ratatoskr.run/netdev/2025/05/3048935/t.md

```text
On Fri, May 9, 2025 at 11:11 AM Matthew Wilcox [ref] wrote:
>
> On Fri, May 09, 2025 at 10:32:08AM -0700, Mina Almasry wrote:
> > Currently the only restriction on net_iov is that some of its fields
> > need to be cache aligned with some of the fields of struct page, but
>
> Cache aligned?  Do you mean alias (ie be at the same offset)?
>
> > What I would suggest here is, roughly:
> >
> > 1. Add a new struct:
> >
> >                struct netmem_desc {
> >                        unsigned long pp_magic;
> >                        struct page_pool *pp;
> >                        unsigned long _pp_mapping_pad;
> >                        unsigned long dma_addr;
> >                        atomic_long_t pp_ref_count;
> >                };
> >
> > 2. Then update struct page to include this entry instead of the definitions:
> >
> > struct page {
> > ...
> >                struct netmem_desc place_holder_1; /* for page pool */
> > ...
> > }
>
> No, the point is to move these fields out of struct page entirely.
>
> At some point (probably this year), we'll actually kmalloc the netmem_desc
> (and shrink struct page), but for now, it'll overlap the other fields
> in struct page.
>

Right, all I'm saying is that if it's at all possible to keep net_iov
something that can be extended with fields unrelated to struct page,
lets do that. net_iov already has fields that should not belong in
struct page like net_iov_owner and I think more will be added.

I'm thinking netmem_desc can be the fields that are shared between
struct net_iov and struct page (but both can have more specific to the
different memory types). As you say, for now netmem_desc can currently
overlap fields in struct page and struct net_iov, and a follow up
change can replace it with something that gets kmalloced and (I
guess?) there is a pointer in struct page or struct net_iov that
refers to the netmem_desc that contains the shared fields.


-- 
Thanks,
Mina
```
