* [PATCH net-next] neighbour: use kvzalloc()/kvfree()
@ 2024-10-22 15:00 Eric Dumazet
2024-10-22 16:14 ` Joe Damato
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Eric Dumazet @ 2024-10-22 15:00 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: netdev, eric.dumazet, Eric Dumazet, Gilad Naaman
mm layer is providing convenient functions, we do not have
to work around old limitations.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Gilad Naaman <gnaaman@drivenets.com>
---
net/core/neighbour.c | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 395ae1626eef2f22f5b81051671371ed67eb5943..4b871cecd2cee9ccc88e5d29d090c49978cbae9f 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -14,7 +14,6 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/slab.h>
-#include <linux/kmemleak.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/module.h>
@@ -538,14 +537,7 @@ static struct neigh_hash_table *neigh_hash_alloc(unsigned int shift)
ret = kmalloc(sizeof(*ret), GFP_ATOMIC);
if (!ret)
return NULL;
- if (size <= PAGE_SIZE) {
- buckets = kzalloc(size, GFP_ATOMIC);
- } else {
- buckets = (struct neighbour __rcu **)
- __get_free_pages(GFP_ATOMIC | __GFP_ZERO,
- get_order(size));
- kmemleak_alloc(buckets, size, 1, GFP_ATOMIC);
- }
+ buckets = kvzalloc(size, GFP_ATOMIC);
if (!buckets) {
kfree(ret);
return NULL;
@@ -562,15 +554,8 @@ static void neigh_hash_free_rcu(struct rcu_head *head)
struct neigh_hash_table *nht = container_of(head,
struct neigh_hash_table,
rcu);
- size_t size = (1 << nht->hash_shift) * sizeof(struct neighbour *);
- struct neighbour __rcu **buckets = nht->hash_buckets;
- if (size <= PAGE_SIZE) {
- kfree(buckets);
- } else {
- kmemleak_free(buckets);
- free_pages((unsigned long)buckets, get_order(size));
- }
+ kvfree(nht->hash_buckets);
kfree(nht);
}
--
2.47.0.105.g07ac214952-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net-next] neighbour: use kvzalloc()/kvfree()
2024-10-22 15:00 [PATCH net-next] neighbour: use kvzalloc()/kvfree() Eric Dumazet
@ 2024-10-22 16:14 ` Joe Damato
2024-10-22 21:11 ` Kuniyuki Iwashima
2024-10-29 2:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Joe Damato @ 2024-10-22 16:14 UTC (permalink / raw)
To: Eric Dumazet
Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, netdev,
eric.dumazet, Gilad Naaman
On Tue, Oct 22, 2024 at 03:00:59PM +0000, Eric Dumazet wrote:
> mm layer is providing convenient functions, we do not have
> to work around old limitations.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Gilad Naaman <gnaaman@drivenets.com>
> ---
Reviewed-by: Joe Damato <jdamato@fastly.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] neighbour: use kvzalloc()/kvfree()
2024-10-22 15:00 [PATCH net-next] neighbour: use kvzalloc()/kvfree() Eric Dumazet
2024-10-22 16:14 ` Joe Damato
@ 2024-10-22 21:11 ` Kuniyuki Iwashima
2024-10-29 2:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Kuniyuki Iwashima @ 2024-10-22 21:11 UTC (permalink / raw)
To: edumazet
Cc: davem, eric.dumazet, gnaaman, kuba, netdev, pabeni,
Kuniyuki Iwashima
From: Eric Dumazet <edumazet@google.com>
Date: Tue, 22 Oct 2024 15:00:59 +0000
> mm layer is providing convenient functions, we do not have
> to work around old limitations.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Gilad Naaman <gnaaman@drivenets.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] neighbour: use kvzalloc()/kvfree()
2024-10-22 15:00 [PATCH net-next] neighbour: use kvzalloc()/kvfree() Eric Dumazet
2024-10-22 16:14 ` Joe Damato
2024-10-22 21:11 ` Kuniyuki Iwashima
@ 2024-10-29 2:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-29 2:40 UTC (permalink / raw)
To: Eric Dumazet; +Cc: davem, kuba, pabeni, netdev, eric.dumazet, gnaaman
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 22 Oct 2024 15:00:59 +0000 you wrote:
> mm layer is providing convenient functions, we do not have
> to work around old limitations.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Gilad Naaman <gnaaman@drivenets.com>
> ---
> net/core/neighbour.c | 19 ++-----------------
> 1 file changed, 2 insertions(+), 17 deletions(-)
Here is the summary with links:
- [net-next] neighbour: use kvzalloc()/kvfree()
https://git.kernel.org/netdev/net-next/c/ab101c553bc1
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-10-29 2:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-22 15:00 [PATCH net-next] neighbour: use kvzalloc()/kvfree() Eric Dumazet
2024-10-22 16:14 ` Joe Damato
2024-10-22 21:11 ` Kuniyuki Iwashima
2024-10-29 2:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox