mirror of
https://github.com/torvalds/linux.git
synced 2026-06-05 04:56:13 +02:00
neighbour: Replace kvzalloc() with kzalloc() when GFP_ATOMIC is specified
kzalloc() uses page allocator when size is larger than KMALLOC_MAX_CACHE_SIZE, so the intention of commitab101c553b("neighbour: use kvzalloc()/kvfree()") can be achieved by using kzalloc(). When using GFP_ATOMIC, kvzalloc() only tries the kmalloc path, since the vmalloc path does not support the flag. In this case, kvzalloc() is equivalent to kzalloc() in that neither try the vmalloc path, so this replacement brings no functional change. This is primarily a cleanup change, as the original code functions correctly. This patch replaces kvzalloc() introduced by commit41b3caa7c0("neighbour: Add hlist_node to struct neighbour"), which is called in the same context and with the same gfp flag as the aforementioned commitab101c553b("neighbour: use kvzalloc()/kvfree()"). Signed-off-by: Kohei Enju <enjuk@amazon.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Link: https://patch.msgid.link/20250219102227.72488-1-enjuk@amazon.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
5225861b5c
commit
ef75d8343b
|
|
@ -518,7 +518,7 @@ static struct neigh_hash_table *neigh_hash_alloc(unsigned int shift)
|
|||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
hash_heads = kvzalloc(size, GFP_ATOMIC);
|
||||
hash_heads = kzalloc(size, GFP_ATOMIC);
|
||||
if (!hash_heads) {
|
||||
kfree(ret);
|
||||
return NULL;
|
||||
|
|
@ -536,7 +536,7 @@ static void neigh_hash_free_rcu(struct rcu_head *head)
|
|||
struct neigh_hash_table,
|
||||
rcu);
|
||||
|
||||
kvfree(nht->hash_heads);
|
||||
kfree(nht->hash_heads);
|
||||
kfree(nht);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user