Skip to content
Commit f8cbf6bd authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski
Browse files

netlink: use kvmalloc() in netlink_alloc_large_skb()

This is a followup of commit 234ec0b6

 ("netlink: fix potential
sleeping issue in mqueue_flush_file"), because vfree_atomic()
overhead is unfortunate for medium sized allocations.

1) If the allocation is smaller than PAGE_SIZE, do not bother
   with vmalloc() at all. Some arches have 64KB PAGE_SIZE,
   while NLMSG_GOODSIZE is smaller than 8KB.

2) Use kvmalloc(), which might allocate one high order page
   instead of vmalloc if memory is not too fragmented.

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
Link: https://lore.kernel.org/r/20240224090630.605917-1-edumazet@google.com
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent c4b04a80
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