[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250528054100.GB9346@system.software.com>
Date: Wed, 28 May 2025 14:41:00 +0900
From: Byungchul Park <byungchul@...com>
To: Mina Almasry <almasrymina@...gle.com>
Cc: willy@...radead.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
kernel_team@...ynix.com, kuba@...nel.org,
ilias.apalodimas@...aro.org, harry.yoo@...cle.com, hawk@...nel.org,
akpm@...ux-foundation.org, davem@...emloft.net,
john.fastabend@...il.com, andrew+netdev@...n.ch,
asml.silence@...il.com, toke@...hat.com, tariqt@...dia.com,
edumazet@...gle.com, pabeni@...hat.com, saeedm@...dia.com,
leon@...nel.org, ast@...nel.org, daniel@...earbox.net,
david@...hat.com, lorenzo.stoakes@...cle.com,
Liam.Howlett@...cle.com, vbabka@...e.cz, rppt@...nel.org,
surenb@...gle.com, mhocko@...e.com, horms@...nel.org,
linux-rdma@...r.kernel.org, bpf@...r.kernel.org,
vishal.moola@...il.com
Subject: Re: [PATCH v2 02/16] netmem: introduce netmem alloc APIs to wrap
page alloc APIs
On Tue, May 27, 2025 at 08:11:58PM -0700, Mina Almasry wrote:
> On Tue, May 27, 2025 at 7:29 PM Byungchul Park <byungchul@...com> wrote:
> >
> > To eliminate the use of struct page in page pool, the page pool code
> > should use netmem descriptor and APIs instead.
> >
> > As part of the work, introduce netmem alloc APIs allowing the code to
> > use them rather than the existing APIs for struct page.
> >
> > Signed-off-by: Byungchul Park <byungchul@...com>
> > ---
> > include/net/netmem.h | 13 +++++++++++++
> > 1 file changed, 13 insertions(+)
> >
> > diff --git a/include/net/netmem.h b/include/net/netmem.h
> > index a721f9e060a2..37d0e0e002c2 100644
> > --- a/include/net/netmem.h
> > +++ b/include/net/netmem.h
> > @@ -177,6 +177,19 @@ static inline netmem_ref page_to_netmem(struct page *page)
> > return (__force netmem_ref)page;
> > }
> >
> > +static inline netmem_ref alloc_netmems_node(int nid, gfp_t gfp_mask,
> > + unsigned int order)
> > +{
> > + return page_to_netmem(alloc_pages_node(nid, gfp_mask, order));
> > +}
> > +
> > +static inline unsigned long alloc_netmems_bulk_node(gfp_t gfp, int nid,
> > + unsigned long nr_netmems, netmem_ref *netmem_array)
> > +{
> > + return alloc_pages_bulk_node(gfp, nid, nr_netmems,
> > + (struct page **)netmem_array);
> > +}
> > +
> > /**
> > * virt_to_netmem - convert virtual memory pointer to a netmem reference
> > * @data: host memory pointer to convert
>
> Code looks fine to me, but I'm not sure we want to export these
> helpers in include/net where they're available to the entire kernel
> and net stack. Can we put these helpers in net/core/page_pool.c or at
> least net/core/netmem_priv.h?
>
> Also maybe the helpers aren't needed anyway. AFAICT there is only 1
> call site in page_pool.c for each, so maybe we can implement this
> inline.
Ah. I recalled the reason why I added these APIs this way, that is, to
make the allocation method easier to be altered in the future. I will
move it to net/core/netmem_priv.h but keep it in the header anyway.
Byungchul
>
> --
> Thanks,
> Mina
Powered by blists - more mailing lists