Re: [PATCH v4 1/2] drivers: net: prevent tun_build_skb() to exceed the packet size limit
From: Jesper Dangaard Brouer
Date: Fri Aug 04 2023 - 05:30:22 EST
On 03/08/2023 19.53, Andrew Kanner wrote:
Question to Jason Wang:
Why fall back (to e.g. tun_alloc_skb()) when size is above PAGE_SIZE?
AFAIK tun_build_skb()*can* create get larger packets than PAGE_SIZE
from it's page_frag. Is there a reason for this limitation?
>> I couldn't recall but I think we can relax.
> Jesper already sent enough info for this idea in v2, I will use it for
the next patch/series.
I have some more input and considerations when selecting the new
constant that replace PAGE_SIZE.
Lets see if Eric Dumazet or Alex Duyck disagree?
("inventors" of page_frag scheme)
The function tun_alloc_skb() uses a page_frag scheme for allocation.
The maximim size is 32768 bytes (Order-3), but using something that is
close to this max alloc size can cause memory waste and fragmentation.
My suggestion would be to use the constant SKB_MAX_ALLOC (16KiB).
Maybe Eric or Alex would recommend using something smaller? (e.g. 8192)
page_frag limit comes from:
#define SKB_FRAG_PAGE_ORDER get_order(32768)
Jesper, I will add this tag for this next patch/series if you don't
mind:
Suggested-by: Jesper Dangaard Brouer <hawk@xxxxxxxxxx>
ACK