OSDN Git Service

selftests/xsk: Fix munmap for hugepage allocated umem
authorMagnus Karlsson <magnus.karlsson@intel.com>
Tue, 18 Apr 2023 14:36:17 +0000 (16:36 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 19 Apr 2023 14:33:53 +0000 (16:33 +0200)
commit2ddade322925641ee2a75f13665c51f2e74d7791
treec9f1151f63000b03b6d981b071ec36f2a1a446d6
parent276dcdd1a8f33047524dd0ae517290f0842fe4b8
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
tools/testing/selftests/bpf/xskxceiver.c
tools/testing/selftests/bpf/xskxceiver.h