David Hildenbrand <david@xxxxxxxxxx> writes: > On 13.04.23 15:07, David Hildenbrand wrote: >> On 12.04.23 05:16, Stefan Roesch wrote: >>> This adds three new tests to the selftests for KSM. These tests use the >>> new prctl API's to enable and disable KSM. >>> >>> 1) add new prctl flags to prctl header file in tools dir >>> >>> This adds the new prctl flags to the include file prct.h in the >>> tools directory. This makes sure they are available for testing. >>> >>> 2) add KSM prctl merge test >>> >>> This adds the -t option to the ksm_tests program. The -t flag >>> allows to specify if it should use madvise or prctl ksm merging. >>> >>> 3) add KSM get merge type test >>> >>> This adds the -G flag to the ksm_tests program to query the KSM >>> status with prctl after KSM has been enabled with prctl. >>> >>> 4) add KSM fork test >>> >>> Add fork test to verify that the MMF_VM_MERGE_ANY flag is inherited >>> by the child process. >>> >>> 5) add two functions for debugging merge outcome >>> >>> This adds two functions to report the metrics in /proc/self/ksm_stat >>> and /sys/kernel/debug/mm/ksm. >>> >>> The debugging can be enabled with the following command line: >>> make -C tools/testing/selftests TARGETS="mm" --keep-going \ >>> EXTRA_CFLAGS=-DDEBUG=1 >> Would it make sense to instead have a "-D" (if still unused) runtime >> options to print this data? Dead code that's not compiled is a bit >> unfortunate as it can easily bit-rot. >> This patch essentially does two things >> 1) Add the option to run all tests/benchmarks with the PRCTL instead of >> MADVISE >> 2) Add some functional KSM tests for the new PRCTL (fork, enabling >> works, disabling works). >> The latter should rather go into ksm_functional_tests(). > > > "tools/testing/selftests/mm/ksm_functional_tests.c" is what I wanted to say. I understood. I'll look into moving the fork check and the disabling into the functional tests for the next version.