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.