Thread (49 messages) flat view 49 messages, 4 authors, 2025-07-28

Re: [PATCH net-next v9 5/8] netmem: introduce a netmem API, virt_to_head_netmem()

From: Mina Almasry <hidden>
Date: 2025-07-10 18:26:47
Also in: bpf, linux-mm, linux-rdma, lkml

On Thu, Jul 10, 2025 at 1:28 AM 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>
Reviewed-by: Toke Høiland-Jørgensen <redacted>
Reviewed-by: Pavel Begunkov <asml.silence@gmail.com>
Reviewed-by: Mina Almasry <redacted>
---
 include/net/netmem.h | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/include/net/netmem.h b/include/net/netmem.h
index 283b4a997fbc..b92c7f15166a 100644
--- a/include/net/netmem.h
+++ b/include/net/netmem.h
@@ -372,6 +372,13 @@ static inline bool page_pool_page_is_pp(struct page *page)
 }
 #endif

+static inline netmem_ref virt_to_head_netmem(const void *x)
+{
+       netmem_ref netmem = virt_to_netmem(x);
+
+       return netmem_compound_head(netmem);
+}
+
Squash with the first user of this helper please.


-- 
Thanks,
Mina
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help