[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <224e100b-6874-2993-a743-0a93ca0201fd@kernel.org>
Date: Fri, 4 Aug 2023 11:30:03 +0200
From: Jesper Dangaard Brouer <hawk@...nel.org>
To: Andrew Kanner <andrew.kanner@...il.com>, Jason Wang <jasowang@...hat.com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, netdev@...r.kernel.org, dsahern@...il.com,
jbrouer@...hat.com, john.fastabend@...il.com, linux-kernel@...r.kernel.org,
linux-kernel-mentees@...ts.linuxfoundation.org,
syzbot+f817490f5bd20541b90a@...kaller.appspotmail.com,
Alexander Duyck <alexander.duyck@...il.com>
Subject: Re: [PATCH v4 1/2] drivers: net: prevent tun_build_skb() to exceed
the packet size limit
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@...nel.org>
ACK
Powered by blists - more mailing lists