summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/xskxceiver.h
diff options
context:
space:
mode:
authorMagnus Karlsson <magnus.karlsson@intel.com>2023-04-18 17:36:17 +0300
committerDaniel Borkmann <daniel@iogearbox.net>2023-04-19 17:33:53 +0300
commit2ddade322925641ee2a75f13665c51f2e74d7791 (patch)
treec9f1151f63000b03b6d981b071ec36f2a1a446d6 /tools/testing/selftests/bpf/xskxceiver.h
parent276dcdd1a8f33047524dd0ae517290f0842fe4b8 (diff)
downloadlinux-2ddade322925641ee2a75f13665c51f2e74d7791.tar.xz
selftests/xsk: Fix munmap for hugepage allocated umem
Fix the unmapping of hugepage allocated umems so that they are properly unmapped. The new test referred to in the fixes label, introduced a test that allocated a umem that is not a multiple of a 2M hugepage size. This is fine for mmap() that rounds the size up the nearest multiple of 2M. But munmap() requires the size to be a multiple of the hugepage size in order for it to unmap the region. The current behaviour of not properly unmapping the umem, was discovered when further additions of tests that require hugepages (unaligned mode tests only) started failing as the system was running out of hugepages. Fixes: c0801598e543 ("selftests: xsk: Add test UNALIGNED_INV_DESC_4K1_FRAME_SIZE") Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20230418143617.27762-1-magnus.karlsson@gmail.com
Diffstat (limited to 'tools/testing/selftests/bpf/xskxceiver.h')
-rw-r--r--tools/testing/selftests/bpf/xskxceiver.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/xskxceiver.h b/tools/testing/selftests/bpf/xskxceiver.h
index 919327807a4e..c535aeab2ca3 100644
--- a/tools/testing/selftests/bpf/xskxceiver.h
+++ b/tools/testing/selftests/bpf/xskxceiver.h
@@ -56,6 +56,7 @@
#define RX_FULL_RXQSIZE 32
#define UMEM_HEADROOM_TEST_SIZE 128
#define XSK_UMEM__INVALID_FRAME_SIZE (XSK_UMEM__DEFAULT_FRAME_SIZE + 1)
+#define HUGEPAGE_SIZE (2 * 1024 * 1024)
#define print_verbose(x...) do { if (opt_verbose) ksft_print_msg(x); } while (0)