Re: [PATCH v4 1/2] drivers: net: prevent tun_build_skb() to exceed the packet size limit
From: Jesper Dangaard Brouer <hawk@kernel.org>
Date: 2023-08-04 09:30:22
Also in:
linux-kernel-mentees, lkml
From: Jesper Dangaard Brouer <hawk@kernel.org>
Date: 2023-08-04 09:30:22
Also in:
linux-kernel-mentees, lkml
On 03/08/2023 19.53, Andrew Kanner wrote:
quoted
quoted
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?quoted
I couldn't recall but I think we can relax.Jesper already sent enough info for this idea in v2, I will use it forthe 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@kernel.org>
ACK