diff options
author | Eric Dumazet <edumazet@google.com> | 2023-08-01 22:52:53 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-08-03 03:44:55 +0200 |
commit | ae6db08f8b5606ccd95ef2aadd741905d3c13bc0 (patch) | |
tree | acb91bcdeeeca126f28acf1e77e9b53eccc68ef6 /net/packet | |
parent | net: tun: change tun_alloc_skb() to allow bigger paged allocations (diff) | |
download | linux-ae6db08f8b5606ccd95ef2aadd741905d3c13bc0.tar.xz linux-ae6db08f8b5606ccd95ef2aadd741905d3c13bc0.zip |
net/packet: change packet_alloc_skb() to allow bigger paged allocations
packet_alloc_skb() is currently calling sock_alloc_send_pskb()
forcing order-0 page allocations.
Switch to PAGE_ALLOC_COSTLY_ORDER, to increase max size by 8x.
Also add logic to increase the linear part if needed.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Tahsin Erdogan <trdgn@amazon.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/r/20230801205254.400094-4-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/packet')
-rw-r--r-- | net/packet/af_packet.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 8e3ddec4c3d5..3b77d255d22d 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -2927,8 +2927,10 @@ static struct sk_buff *packet_alloc_skb(struct sock *sk, size_t prepad, if (prepad + len < PAGE_SIZE || !linear) linear = len; + if (len - linear > MAX_SKB_FRAGS * (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) + linear = len - MAX_SKB_FRAGS * (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER); skb = sock_alloc_send_pskb(sk, prepad + linear, len - linear, noblock, - err, 0); + err, PAGE_ALLOC_COSTLY_ORDER); if (!skb) return NULL; |