Re: [RFC v4 16/18] netmem: introduce a netmem API, virt_to_head_netmem()

From
Mina Almasry <hidden>
Date
2025-06-05 19:43:56
Also in
bpf, linux-mm, linux-rdma, lkml
Reply to
Byungchul Park, 2025-06-04
On Tue, Jun 3, 2025 at 7:53 PM Byungchul Park [off-list ref] wrote:
quoted hunk ↗ jump to hunk
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 a netmem API to convert a virtual address
to a head netmem allowing the code to use it rather than the existing
API, virt_to_head_page() for struct page.

Signed-off-by: Byungchul Park <byungchul@sk.com>
---
 include/net/netmem.h | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/include/net/netmem.h b/include/net/netmem.h
index d4066fcb1fee..d84ab624b489 100644
--- a/include/net/netmem.h
+++ b/include/net/netmem.h
@@ -265,6 +265,13 @@ static inline netmem_ref netmem_compound_head(netmem_ref netmem)
        return page_to_netmem(compound_head(netmem_to_page(netmem)));
 }

+static inline netmem_ref virt_to_head_netmem(const void *x)
+{
+       netmem_ref netmem = virt_to_netmem(x);
+
+       return netmem_compound_head(netmem);
+}
+
I would squash with the patch that first calls this to shrink the
series, but anyway:

Reviewed-by: Mina Almasry <redacted>

-- 
Thanks,
Mina
Thread (65 messages) 65 messages, 6 authors, last reply 2025-06-09
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help