aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/net/tap.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2023-08-01 20:52:54 +0000
committerJakub Kicinski <kuba@kernel.org>2023-08-02 18:44:56 -0700
commit37dfe5b8ddeb7c0bb97e3643dcfd8f9f1421ad25 (patch)
treead9f5d1ccdab0aea0327a88651f8789910baef0c /drivers/net/tap.c
parentnet/packet: change packet_alloc_skb() to allow bigger paged allocations (diff)
downloadwireguard-linux-37dfe5b8ddeb7c0bb97e3643dcfd8f9f1421ad25.tar.xz
wireguard-linux-37dfe5b8ddeb7c0bb97e3643dcfd8f9f1421ad25.zip
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: 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-5-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/tap.c')
-rw-r--r--drivers/net/tap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/tap.c b/drivers/net/tap.c
index 9137fb8c1c42..01574b9d410f 100644
--- a/drivers/net/tap.c
+++ b/drivers/net/tap.c
@@ -614,8 +614,10 @@ static inline struct sk_buff *tap_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;