Skip to contentSkip to conversation

selftests/vm: Add tests validating mremap mirror functionality

PATCH In review Anshuman Khandual 2 participants 2 messages Oct 30, 2017 – Nov 1, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/vm: Add tests validating mremap mirror functionality

This adds two tests to validate mirror functionality with mremap() system call on shared and private anon mappings. After the commit dba58d3b8c5 ("mm/mremap: fail map duplication attempts for private mappings"), any attempt to mirror private anon mapping will fail.

---
Changes in V4:

- Folded these two test files into just one as per Mike
- Did some renaming of functions, cleans ups etc

Changes in V3: (https://patchwork.kernel.org/patch/10013469/)

- Fail any attempts to mirror an existing anon private mapping
- Updated run_vmtests to include these new mremap tests
- Updated the commit message

Changes in V2: (https://patchwork.kernel.org/patch/9861259/)

- Added a test for private anon mappings
- Used sysconf(_SC_PAGESIZE) instead of hard coding page size
- Used MREMAP_MAYMOVE instead of hard coding the flag value 1

Original V1: (https://patchwork.kernel.org/patch/9854415/)

 tools/testing/selftests/vm/Makefile        |  1 +
 tools/testing/selftests/vm/mremap_mirror.c | 96 ++++++++++++++++++++++++++++++
 tools/testing/selftests/vm/run_vmtests     | 10 ++++
 3 files changed, 107 insertions(+)
 create mode 100644 tools/testing/selftests/vm/mremap_mirror.c
tools/testing/selftests/vm/Makefile +1 -0
index cbb29e4..27f1967 100644
@@ -17,6 +17,7 @@ TEST_GEN_FILES += transhuge-stress
 TEST_GEN_FILES += userfaultfd
 TEST_GEN_FILES += mlock-random-test
 TEST_GEN_FILES += virtual_address_range
+TEST_GEN_FILES += mremap_mirror
 
 TEST_PROGS := run_vmtests
 
tools/testing/selftests/vm/mremap_mirror.c new file +96 -0

96 lines not on this page · raw message

tools/testing/selftests/vm/run_vmtests +10 -0
index 07548a1..7214aa2 100755
@@ -176,4 +176,14 @@ else
 	echo "[PASS]"
 fi
 
+echo "-----------------------------"
+echo "mremap_mirror"
+echo "-----------------------------"
+./mremap_mirror
+if [ $? -ne 0 ]; then
+	echo "[FAIL]"
+	exitcode=1
+else
+	echo "[PASS]"
+fi
 exit $exitcode
Signature · 1 line
1.8.5.2
#1 lore raw
Quoted 20 lines · Anshuman Khandual

This adds two tests to validate mirror functionality with mremap() system call on shared and private anon mappings. After the commit dba58d3b8c5 ("mm/mremap: fail map duplication attempts for private mappings"), any attempt to mirror private anon mapping will fail.

---
Changes in V4:

- Folded these two test files into just one as per Mike
- Did some renaming of functions, cleans ups etc

Changes in V3: (https://patchwork.kernel.org/patch/10013469/)

- Fail any attempts to mirror an existing anon private mapping
- Updated run_vmtests to include these new mremap tests
- Updated the commit message

Quoted 7 lines

Changes in V2: (https://patchwork.kernel.org/patch/9861259/)

- Added a test for private anon mappings
- Used sysconf(_SC_PAGESIZE) instead of hard coding page size
- Used MREMAP_MAYMOVE instead of hard coding the flag value 1

Original V1: (https://patchwork.kernel.org/patch/9854415/)

Thanks. I will queue this up for 4.15-rc1

-- Shuah

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>