]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/xsk: Introduce mmap_size in umem struct
authorTushar Vyavahare <tushar.vyavahare@intel.com>
Mon, 8 Jun 2026 13:09:37 +0000 (18:39 +0530)
committerJakub Kicinski <kuba@kernel.org>
Fri, 12 Jun 2026 22:23:31 +0000 (15:23 -0700)
commit0fe61052acb09bab7ac2b39b2249d11d8b5dbdf7
tree52b30df3157c503d12676561a7863846f974ec54
parent1a24fe421739fc369fb15c515b9e114440df49df
selftests/xsk: Introduce mmap_size in umem struct

UMEM teardown currently recomputes the munmap() length from frame
geometry, shared-UMEM adjustment, and hugepage rounding. This duplicates
setup-time logic in cleanup and relies on re-deriving the mapping size
instead of using the size originally established for the mapping.

Store the final mapping length in xsk_umem_info as mmap_size when the
UMEM mapping is created, and use that value during teardown.

Also join the RX worker thread before cleanup in the single-thread
path. This establishes synchronization before reading umem->mmap_size
in teardown and avoids a potential visibility race.

This removes duplicated size arithmetic in cleanup and makes munmap()
use the canonical mapping size recorded at setup time.

Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Tushar Vyavahare <tushar.vyavahare@intel.com>
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Link: https://patch.msgid.link/20260608130938.958793-5-tushar.vyavahare@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/bpf/prog_tests/test_xsk.c
tools/testing/selftests/bpf/prog_tests/test_xsk.h