Mshare is a developing feature proposed by Anthony Yznaga and Khalid Aziz that enables sharing of PTEs across processes. The V3 patch set has been posted for review:
https://lore.kernel.org/linux-mm/20250820010415.699353-1-anthony.yznaga@orac...
This patch set adds selftests to exercise and demonstrate basic functionality of mshare.
The initial tests use open, ioctl, and mmap syscalls to establish a shared memory mapping between two processes and verify the expected behavior.
Additional tests are included to check interoperability with swap and Transparent Huge Pages.
Future work will extend coverage to other use cases such as integration with KVM and more advanced scenarios.
This series is intended to be applied on top of mshare V3, which is based on mm-new (2025-08-15).
-----------------
V1->V2: - Based on mshare V3, which based on mm-new as of 2025-08-15 - (Fix) For test cases in basic.c, Change to use a small chunk of memory(4k/8K for normal pages, 2M/4M for hugetlb pages), as to ensure these tests can run on any server or device. - (Fix) For test cases of hugetlb, swap and THP, add a tips to configure corresponding settings. - (Fix) Add memory to .gitignore file once it exists - (fix) Correct the Changelog of THP test case that mshare support THP only when user configure shmem_enabled as always
V1: https://lore.kernel.org/all/20250825145719.29455-1-linyongting@bytedance.com...
Yongting Lin (8): mshare: Add selftests mshare: selftests: Adding config fragments mshare: selftests: Add some helper functions for mshare filesystem mshare: selftests: Add test case shared memory mshare: selftests: Add test case ioctl unmap mshare: selftests: Add some helper functions for configuring and retrieving cgroup mshare: selftests: Add test case to demostrate the swapping of mshare memory mshare: selftests: Add test case to demostrate that mshare partly supports THP
tools/testing/selftests/mshare/.gitignore | 4 + tools/testing/selftests/mshare/Makefile | 7 + tools/testing/selftests/mshare/basic.c | 109 ++++++++++ tools/testing/selftests/mshare/config | 1 + tools/testing/selftests/mshare/memory.c | 89 ++++++++ tools/testing/selftests/mshare/util.c | 254 ++++++++++++++++++++++ 6 files changed, 464 insertions(+) create mode 100644 tools/testing/selftests/mshare/.gitignore create mode 100644 tools/testing/selftests/mshare/Makefile create mode 100644 tools/testing/selftests/mshare/basic.c create mode 100644 tools/testing/selftests/mshare/config create mode 100644 tools/testing/selftests/mshare/memory.c create mode 100644 tools/testing/selftests/mshare/util.c