Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

xsk: Use kvcalloc to support large umems

Use kvcalloc() instead of kcalloc() to support large umems with, on my
server, one million pages or more in the umem.

Reported-by: Dan Siemon <dan@coverfire.com>
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Björn Töpel <bjorn@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20210521083301.26921-1-magnus.karlsson@gmail.com

authored by

Magnus Karlsson and committed by
Daniel Borkmann
a720a2a0 8fb33b60

+3 -4
+3 -4
net/xdp/xdp_umem.c
··· 27 27 { 28 28 unpin_user_pages_dirty_lock(umem->pgs, umem->npgs, true); 29 29 30 - kfree(umem->pgs); 30 + kvfree(umem->pgs); 31 31 umem->pgs = NULL; 32 32 } 33 33 ··· 99 99 long npgs; 100 100 int err; 101 101 102 - umem->pgs = kcalloc(umem->npgs, sizeof(*umem->pgs), 103 - GFP_KERNEL | __GFP_NOWARN); 102 + umem->pgs = kvcalloc(umem->npgs, sizeof(*umem->pgs), GFP_KERNEL | __GFP_NOWARN); 104 103 if (!umem->pgs) 105 104 return -ENOMEM; 106 105 ··· 122 123 out_pin: 123 124 xdp_umem_unpin_pages(umem); 124 125 out_pgs: 125 - kfree(umem->pgs); 126 + kvfree(umem->pgs); 126 127 umem->pgs = NULL; 127 128 return err; 128 129 }