Re: [PATCH net-next v16 05/13] page_pool: devmem support

From
Jakub Kicinski <kuba@kernel.org>
Date
2024-07-11 01:22:05
Also in
bpf, dri-devel, linux-alpha, linux-arch, linux-doc, linux-kselftest, linux-media, linux-mips, linux-mm, lkml, netdev, sparclinux
Reply to
Mina Almasry, 2024-07-10
On Wed, 10 Jul 2024 13:29:03 -0700 Mina Almasry wrote:
quoted hunk ↗ jump to hunk
If we want to add __skb_frag_ref() support for net_iov I suggest something like:
diff --git a/include/linux/skbuff_ref.h b/include/linux/skbuff_ref.h
index 0f3c58007488a..02f7f4c7d4821 100644
--- a/include/linux/skbuff_ref.h
+++ b/include/linux/skbuff_ref.h
@@ -17,7 +17,13 @@
  */
 static inline void __skb_frag_ref(skb_frag_t *frag)
 {
-       get_page(skb_frag_page(frag));
+       netmem_ref netmem = skb_frag_netmem(frag);
+
+       /* netmem always uses pp-refs for refcounting. Never non-pp refs. */
+       if (!netmem_is_net_iov(netmem))
+               get_page(netmem_to_page(netmem));
+       else
+               page_pool_ref_netmem(netmem);
 }
Probably not much better since freeing still looks at the recycle bit.
Eric and Willem acked patch 8, maybe it works, and if it doesn't we
know who to call :) I can't point out any case that won't work so if 
y'all think this is fine, let's leave it.
Thread (32 messages) 32 messages, 3 authors, last reply 2024-07-11
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