From: Jakub Kicinski <kuba@kernel.org>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, eric.dumazet@gmail.com,
Zhengchao Shao <shaozhengchao@huawei.com>
Subject: Re: [PATCH net-next] netlink: use kvmalloc() in netlink_alloc_large_skb()
Date: Tue, 27 Feb 2024 09:52:44 -0800 [thread overview]
Message-ID: <20240227095244.23e5a740@kernel.org> (raw)
In-Reply-To: <20240224090630.605917-1-edumazet@google.com>
On Sat, 24 Feb 2024 09:06:30 +0000 Eric Dumazet wrote:
> struct sk_buff *netlink_alloc_large_skb(unsigned int size, int broadcast)
> {
> + size_t head_size = SKB_HEAD_ALIGN(size);
> struct sk_buff *skb;
> void *data;
>
> - if (size <= NLMSG_GOODSIZE || broadcast)
> + if (head_size <= PAGE_SIZE || broadcast)
> return alloc_skb(size, GFP_KERNEL);
>
> - size = SKB_DATA_ALIGN(size) +
> - SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
> -
> - data = vmalloc(size);
> - if (data == NULL)
> + data = kvmalloc(head_size, GFP_KERNEL);
> + if (!data)
> return NULL;
>
> - skb = __build_skb(data, size);
> - if (skb == NULL)
> - vfree(data);
> - else
> + skb = __build_skb(data, head_size);
Is this going to work with KFENCE? Don't we need similar size
adjustment logic as we have in __slab_build_skb() ?
> + if (!skb)
> + kvfree(data);
> + else if (is_vmalloc_addr(data))
> skb->destructor = netlink_skb_destructor;
next prev parent reply other threads:[~2024-02-27 17:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-24 9:06 [PATCH net-next] netlink: use kvmalloc() in netlink_alloc_large_skb() Eric Dumazet
2024-02-26 1:33 ` shaozhengchao
2024-02-27 17:52 ` Jakub Kicinski [this message]
2024-02-27 18:15 ` Eric Dumazet
2024-02-27 19:20 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240227095244.23e5a740@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shaozhengchao@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).