Re: [PATCH net 1/2] net: do not run out of frags in alloc_skb_with_frags()

From: Haishuang Yan

Date: Mon Nov 09 2026 - 01:42:36 EST


On Mon, Nov 09, 2026 at 02:07:12AM +0000, netdev-bot+sashiko@xxxxxxxxxx wrote:
> Can alloc_skb_with_frags() still run out of frags when a high-order
> allocation fails? The fallback just below this hunk has not changed:
[...]
> Would it work to treat the frag budget as a hard limit on every order
> reduction? For example, lower the order only when this still covers
> data_len:
>
> (MAX_SKB_FRAGS - nr_frags) * (PAGE_SIZE << (order - 1))

Yes, this is a real problem, and it comes from the same commit: before
09c2c90705bb the limit was MAX_SKB_FRAGS pages, so lowering the order
could never run out of frags.

v2 will only lower the order while the frags left can still hold the
rest. If they can't, it tries the same order once more with the
caller's direct reclaim (with __GFP_NORETRY), and fails only if that
fails too.

pw-bot: cr