* [PATCH bpf-next] xsk: use kvcalloc to support large umems
@ 2021-05-21 8:33 Magnus Karlsson
2021-05-22 14:12 ` Björn Töpel
2021-05-25 11:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 4+ messages in thread
From: Magnus Karlsson @ 2021-05-21 8:33 UTC (permalink / raw)
To: magnus.karlsson, bjorn, ast, daniel, netdev, maciej.fijalkowski
Cc: jonathan.lemon, bpf, Dan Siemon
From: Magnus Karlsson <magnus.karlsson@intel.com>
Use kvcalloc() instead of kcalloc() to support large umems with, on my
server, one million pages or more in the umem.
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Reported-by: Dan Siemon <dan@coverfire.com>
---
net/xdp/xdp_umem.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c
index 56a28a686988..f01ef6bda390 100644
--- a/net/xdp/xdp_umem.c
+++ b/net/xdp/xdp_umem.c
@@ -27,7 +27,7 @@ static void xdp_umem_unpin_pages(struct xdp_umem *umem)
{
unpin_user_pages_dirty_lock(umem->pgs, umem->npgs, true);
- kfree(umem->pgs);
+ kvfree(umem->pgs);
umem->pgs = NULL;
}
@@ -99,8 +99,7 @@ static int xdp_umem_pin_pages(struct xdp_umem *umem, unsigned long address)
long npgs;
int err;
- umem->pgs = kcalloc(umem->npgs, sizeof(*umem->pgs),
- GFP_KERNEL | __GFP_NOWARN);
+ umem->pgs = kvcalloc(umem->npgs, sizeof(*umem->pgs), GFP_KERNEL | __GFP_NOWARN);
if (!umem->pgs)
return -ENOMEM;
@@ -123,7 +122,7 @@ static int xdp_umem_pin_pages(struct xdp_umem *umem, unsigned long address)
out_pin:
xdp_umem_unpin_pages(umem);
out_pgs:
- kfree(umem->pgs);
+ kvfree(umem->pgs);
umem->pgs = NULL;
return err;
}
base-commit: a49e72b3bda73d36664a084e47da9727a31b8095
--
2.29.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] xsk: use kvcalloc to support large umems
2021-05-21 8:33 [PATCH bpf-next] xsk: use kvcalloc to support large umems Magnus Karlsson
@ 2021-05-22 14:12 ` Björn Töpel
2021-05-24 17:59 ` John Fastabend
2021-05-25 11:30 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 4+ messages in thread
From: Björn Töpel @ 2021-05-22 14:12 UTC (permalink / raw)
To: Magnus Karlsson
Cc: Karlsson, Magnus, Alexei Starovoitov, Daniel Borkmann, Netdev,
Fijalkowski, Maciej, Jonathan Lemon, bpf, Dan Siemon
On Fri, 21 May 2021 at 10:33, Magnus Karlsson <magnus.karlsson@gmail.com> wrote:
>
> From: Magnus Karlsson <magnus.karlsson@intel.com>
>
> Use kvcalloc() instead of kcalloc() to support large umems with, on my
> server, one million pages or more in the umem.
>
> Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
> Reported-by: Dan Siemon <dan@coverfire.com>
Nice!
Acked-by: Björn Töpel <bjorn@kernel.org>
> ---
> net/xdp/xdp_umem.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c
> index 56a28a686988..f01ef6bda390 100644
> --- a/net/xdp/xdp_umem.c
> +++ b/net/xdp/xdp_umem.c
> @@ -27,7 +27,7 @@ static void xdp_umem_unpin_pages(struct xdp_umem *umem)
> {
> unpin_user_pages_dirty_lock(umem->pgs, umem->npgs, true);
>
> - kfree(umem->pgs);
> + kvfree(umem->pgs);
> umem->pgs = NULL;
> }
>
> @@ -99,8 +99,7 @@ static int xdp_umem_pin_pages(struct xdp_umem *umem, unsigned long address)
> long npgs;
> int err;
>
> - umem->pgs = kcalloc(umem->npgs, sizeof(*umem->pgs),
> - GFP_KERNEL | __GFP_NOWARN);
> + umem->pgs = kvcalloc(umem->npgs, sizeof(*umem->pgs), GFP_KERNEL | __GFP_NOWARN);
> if (!umem->pgs)
> return -ENOMEM;
>
> @@ -123,7 +122,7 @@ static int xdp_umem_pin_pages(struct xdp_umem *umem, unsigned long address)
> out_pin:
> xdp_umem_unpin_pages(umem);
> out_pgs:
> - kfree(umem->pgs);
> + kvfree(umem->pgs);
> umem->pgs = NULL;
> return err;
> }
>
> base-commit: a49e72b3bda73d36664a084e47da9727a31b8095
> --
> 2.29.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] xsk: use kvcalloc to support large umems
2021-05-22 14:12 ` Björn Töpel
@ 2021-05-24 17:59 ` John Fastabend
0 siblings, 0 replies; 4+ messages in thread
From: John Fastabend @ 2021-05-24 17:59 UTC (permalink / raw)
To: Björn Töpel, Magnus Karlsson
Cc: Karlsson, Magnus, Alexei Starovoitov, Daniel Borkmann, Netdev,
Fijalkowski, Maciej, Jonathan Lemon, bpf, Dan Siemon
Björn Töpel wrote:
> On Fri, 21 May 2021 at 10:33, Magnus Karlsson <magnus.karlsson@gmail.com> wrote:
> >
> > From: Magnus Karlsson <magnus.karlsson@intel.com>
> >
> > Use kvcalloc() instead of kcalloc() to support large umems with, on my
> > server, one million pages or more in the umem.
> >
> > Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
> > Reported-by: Dan Siemon <dan@coverfire.com>
>
> Nice!
>
> Acked-by: Björn Töpel <bjorn@kernel.org>
LGTM as well. I scanned the driver side, thinking there might be
some complication there, but looks like it handles this fine.
Acked-by: John Fastabend <john.fastabend@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] xsk: use kvcalloc to support large umems
2021-05-21 8:33 [PATCH bpf-next] xsk: use kvcalloc to support large umems Magnus Karlsson
2021-05-22 14:12 ` Björn Töpel
@ 2021-05-25 11:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-05-25 11:30 UTC (permalink / raw)
To: Magnus Karlsson
Cc: magnus.karlsson, bjorn, ast, daniel, netdev, maciej.fijalkowski,
jonathan.lemon, bpf, dan
Hello:
This patch was applied to bpf/bpf-next.git (refs/heads/master):
On Fri, 21 May 2021 10:33:01 +0200 you wrote:
> From: Magnus Karlsson <magnus.karlsson@intel.com>
>
> Use kvcalloc() instead of kcalloc() to support large umems with, on my
> server, one million pages or more in the umem.
>
> Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
> Reported-by: Dan Siemon <dan@coverfire.com>
>
> [...]
Here is the summary with links:
- [bpf-next] xsk: use kvcalloc to support large umems
https://git.kernel.org/bpf/bpf-next/c/a720a2a0ad6c
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:[~2021-05-25 11:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-21 8:33 [PATCH bpf-next] xsk: use kvcalloc to support large umems Magnus Karlsson
2021-05-22 14:12 ` Björn Töpel
2021-05-24 17:59 ` John Fastabend
2021-05-25 11:30 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.