Subject: Re: [PATCH net-next v6 07/10] netmem: add a couple of page helper wrappers

From: Toke Høiland-Jørgensen <[email-masked]>
Date: Wed, 04 Dec 2024 11:49:06 +0100

Alexander Lobakin <[email-masked]> writes:

> Add the following netmem counterparts:
>
> * virt_to_netmem() -- simple page_to_netmem(virt_to_page()) wrapper;
> * netmem_is_pfmemalloc() -- page_is_pfmemalloc() for page-backed
> 			    netmems, false otherwise;
>
> and the following "unsafe" versions:
>
> * __netmem_to_page()
> * __netmem_get_pp()
> * __netmem_address()
>
> They do the same as their non-underscored buddies, but assume the netmem
> is always page-backed. When working with header &page_pools, you don't
> need to check whether netmem belongs to the host memory and you can
> never get NULL instead of &page. Checks for the LSB, clearing the LSB,
> branches take cycles and increase object code size, sometimes
> significantly. When you're sure your PP is always host, you can avoid
> this by using the underscored counterparts.
>
> Signed-off-by: Alexander Lobakin <[email-masked]>

Makes sense to have these as helpers, spelling out the constraints

Reviewed-by: Toke Høiland-Jørgensen <[email-masked]>