Warning from napi_get_frags_check()
Subsystems (2)
Hi-
When testing CONFIG_MAX_SKB_FRAGS=45 on ppc64le (pages size 64K), I saw this warning.
[ 0.072724] WARNING: CPU: 0 PID: 1 at net/core/skbuff.c:289 napi_get_frags_check+0x50/0x90
However, when running the same test on x86_64 (page size 4k) I saw no warnings!
Printks from the x86_64 box show that warning should have been displayed.
[ 2.852540] __napi_alloc_skb len=336 SKB_WITH_OVERHEAD(1024)=256 SKB_WITH_OVERHEAD(PAGE_SIZE)=3328 [ 2.852543] napi_get_frags_check skb=ffff936486b23b00 NAPI_HAS_SMALL_PAGE_FRAG=1 skb->head_frag=1
The broken warning is due to this change from commit dbae2b062824 ("net: skb: introduce and use a single page frag cache").
- WARN_ON_ONCE(skb && skb->head_frag);
+ WARN_ON_ONCE(!NAPI_HAS_SMALL_PAGE_FRAG && skb && skb->head_frag);
Since NAPI_HAS_SMALL_PAGE_FRAG is always 1 when page_size=4k the warning will never be displayed on x86_64. Also the "single page frag cache" will never be used in my test case.
1) Would changing __napi_alloc_skb() and __netdev_alloc_skb() to something like below accomplish the original goal?
if ( (MAX_SKB_FRAGS == default-value) && (len <=SKB_WITH_OVERHEAD(1024)) || len > SKB_WITH_OVERHEAD(PAGE_SIZE)......
else
if ( (MAX_SKB_FRAGS > default-value ) && (len <=SKB_WITH_OVERHEAD(2048)) || len > SKB_WITH_OVERHEAD(PAGE_SIZE)......
2) The "page frag cache" would need a corresponding change to switch to a 2k cache with larger MAX_SKB_FRAGS values.
3) napi_get_frags_check() needs fixing.
Regards
David Wilder