lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250605005349.GA37659@system.software.com>
Date: Thu, 5 Jun 2025 09:53:49 +0900
From: Byungchul Park <byungchul@...com>
To: Suren Baghdasaryan <surenb@...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, almasrymina@...gle.com,
	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,
	mhocko@...e.com, horms@...nel.org, linux-rdma@...r.kernel.org,
	bpf@...r.kernel.org, vishal.moola@...il.com
Subject: Re: [RFC v4 02/18] netmem: introduce netmem alloc APIs to wrap page
 alloc APIs

On Wed, Jun 04, 2025 at 08:14:18AM -0700, Suren Baghdasaryan wrote:
> On Tue, Jun 3, 2025 at 7:53 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>
> > ---
> >  net/core/netmem_priv.h | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> >
> > diff --git a/net/core/netmem_priv.h b/net/core/netmem_priv.h
> > index cd95394399b4..32e390908bb2 100644
> > --- a/net/core/netmem_priv.h
> > +++ b/net/core/netmem_priv.h
> > @@ -59,4 +59,18 @@ static inline void netmem_set_dma_index(netmem_ref netmem,
> >         magic = netmem_get_pp_magic(netmem) | (id << PP_DMA_INDEX_SHIFT);
> >         __netmem_clear_lsb(netmem)->pp_magic = magic;
> >  }
> > +
> > +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);
> > +}
> 
> Note: if you want these allocations to be reported in a separate line
> inside /proc/allocinfo you need to use alloc_hooks() like this:

Ah, it looks better to use alloc_hooks().  Thanks.

	Byungchul

> 
> static inline unsigned long alloc_netmems_bulk_node_noprof(gfp_t gfp, int nid,
>                                                    unsigned long nr_netmems,
>                                                    netmem_ref *netmem_array)
> {
>        return alloc_pages_bulk_node_noprof((gfp, nid, nr_netmems,
>                        (struct page **)netmem_array);
> }
> 
> #define alloc_netmems_bulk_node(...) \
>         alloc_hooks(alloc_netmems_bulk_node_noprof(__VA_ARGS__))
> 
> 
> 
> >  #endif
> > --
> > 2.17.1
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ