RE: [PATCH net-next v2 6/6] net: kunit: test netmem, page_pool, and skb frag refcounting
From: Loktionov, Aleksandr
Date: Wed Oct 14 2026 - 06:48:13 EST
> -----Original Message-----
> From: Mina Almasry <almasrymina@xxxxxxxxxx>
> Sent: Monday, October 12, 2026 10:22 AM
> To: netdev@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-
> rdma@xxxxxxxxxxxxxxx; bpf@xxxxxxxxxxxxxxx
> Cc: Mina Almasry <almasrymina@xxxxxxxxxx>; Ayush Sawal
> <ayush.sawal@xxxxxxxxxxx>; Andrew Lunn <andrew+netdev@xxxxxxx>; David S.
> Miller <davem@xxxxxxxxxxxxx>; Eric Dumazet <edumazet@xxxxxxxxxx>; Jakub
> Kicinski <kuba@xxxxxxxxxx>; Paolo Abeni <pabeni@xxxxxxxxxx>; Tariq
> Toukan <tariqt@xxxxxxxxxx>; Simon Horman <horms@xxxxxxxxxx>; Steffen
> Klassert <steffen.klassert@xxxxxxxxxxx>; Herbert Xu
> <herbert@xxxxxxxxxxxxxxxxxxx>; Neal Cardwell <ncardwell@xxxxxxxxxx>;
> Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>; John Fastabend
> <john.fastabend@xxxxxxxxx>; Sabrina Dubroca <sd@xxxxxxxxxxxxxxx>; Eric
> Biggers <ebiggers@xxxxxxxxxx>; Kees Cook <kees@xxxxxxxxxx>; Loktionov,
> Aleksandr <aleksandr.loktionov@xxxxxxxxx>; Uwe Kleine-König (The Capable
> Hub) <u.kleine-koenig@xxxxxxxxxxxx>; Jijie Shao <shaojijie@xxxxxxxxxx>;
> Michael Grzeschik <mgr@xxxxxxxxxx>; Jakub Raczynski
> <j.raczynski@xxxxxxxxxxx>
> Subject: [PATCH net-next v2 6/6] net: kunit: test netmem, page_pool, and
> skb frag refcounting
>
> Verify that non-pp (page._refcount / binding->ref) and page_pool
> (pp_ref_count) references stay balanced without cross-counter leaks or
> underflows across regular pages, page_pool pages, non-pp net_iovs, and
> page_pool net_iovs with both pp_recycle=0 and pp_recycle=1.
>
> Cover get/put_net_iov(), get/put_netmem(), napi_pp_get/put_page(),
> skb_netmem_ref/unref(), skb_frag_ref/unref(), pskb_copy(),
> skb_zerocopy(), skb_shift(), skb_split(), skb_try_coalesce(),
> skb_release_data() (clones, unclone ordering, pskb_extract(), and
> skb_morph()), skb_segment(), and devmem tcp_recvmsg_dmabuf() /
> SO_DEVMEM_DONTNEED.
>
> Export skb_shift() via EXPORT_SYMBOL_IF_KUNIT() so the test links when
> built as a module (CONFIG_NET_TEST=m).
>
> Assisted-by: LLM
> Signed-off-by: Mina Almasry <almasrymina@xxxxxxxxxx>
> ---
> v2:
> - Export skb_shift() via EXPORT_SYMBOL_IF_KUNIT() to fix the
> CONFIG_NET_TEST=m modpost error reported by NIPA.
> - Reset mac_header before skb_segment() and check skb_clone() results
> before reuse (Sashiko).
> - Cover compound tail pages, skb_try_coalesce(), TCP devmem recvmsg and
> SO_DEVMEM_DONTNEED, skb_zerocopy() rollbacks, skb_split()/skb_shift()
> edge cases, and mixed pp_recycle frag_list GSO.
> - Link to v1: https://lore.kernel.org/netdev/20261010083935.3274178-7-
> almasrymina@xxxxxxxxxx/
> ---
> net/core/net_test.c | 1204 +++++++++++++++++++++++++++++++++++++++++++
> net/core/skbuff.c | 2 +
> 2 files changed, 1206 insertions(+)
>
> diff --git a/net/core/net_test.c b/net/core/net_test.c index
> 9c3a590865d26..6f21e6baf7fb3 100644
> --- a/net/core/net_test.c
> +++ b/net/core/net_test.c
> @@ -370,10 +370,1213 @@ static void ip_tunnel_flags_test_run(struct
> kunit *test)
> KUNIT_ASSERT_TRUE(test, __ipt_flag_op(bitmap_equal, exp, out));
> }
>
...
>
> /**
> * skb_prepare_seq_read - Prepare a sequential read of skb data
> --
> 2.56.0.385.gd3acb90ef8-goog
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@xxxxxxxxx>