Commit 37dfe5b8 authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

net: tap: change tap_alloc_skb() to allow bigger paged allocations

tap_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: default avatarEric Dumazet <edumazet@google.com>
Cc: Tahsin Erdogan <trdgn@amazon.com>
Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/r/20230801205254.400094-5-edumazet@google.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent ae6db08f
...@@ -614,8 +614,10 @@ static inline struct sk_buff *tap_alloc_skb(struct sock *sk, size_t prepad, ...@@ -614,8 +614,10 @@ static inline struct sk_buff *tap_alloc_skb(struct sock *sk, size_t prepad,
if (prepad + len < PAGE_SIZE || !linear) if (prepad + len < PAGE_SIZE || !linear)
linear = len; 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, skb = sock_alloc_send_pskb(sk, prepad + linear, len - linear, noblock,
err, 0); err, PAGE_ALLOC_COSTLY_ORDER);
if (!skb) if (!skb)
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment