diff options
| author | Jinjiang Tu <[email protected]> | 2024-03-28 11:10:09 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2024-04-26 03:56:29 +0000 |
| commit | 7abaacb8e5f55c6adaabc1b6bcbc1915e159fd1d (patch) | |
| tree | f2f8d0736a18c4a82d052544b51c5243d0de92df /mm/mm_init.c | |
| parent | mm/ksm: fix ksm exec support for prctl (diff) | |
| download | kernel-7abaacb8e5f55c6adaabc1b6bcbc1915e159fd1d.tar.gz kernel-7abaacb8e5f55c6adaabc1b6bcbc1915e159fd1d.zip | |
selftest/mm: ksm_functional_tests: refactor mmap_and_merge_range()
In order to extend test_prctl_fork() and test_prctl_fork_exec() to make
sure that deduplication really happens, mmap_and_merge_range() needs to be
refactored.
Firstly, mmap_and_merge_range() will be called with no need to call enable
KSM by madvise or prctl. So, switch the 'bool use_prctl' parameter to
enum ksm_merge_mode.
Secondly, mmap_and_merge_range() will be called in child process in the
two testcases, it isn't appropriate to call ksft_test_result_{fail, skip},
because the global variables ksft_{fail, skip} aren't consistent with the
parent process. Thus, convert calls of ksft_test_result_{fail, skip} to
ksft_print_msg(), return differrent error according to the two cases, and
rename mmap_and_merge_range() to __mmap_and_merge_range(). For existing
callers, introduce new mmap_and_merge_range() to handle different return
values of __mmap_and_merge_range().
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Jinjiang Tu <[email protected]>
Suggested-by: David Hildenbrand <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Kefeng Wang <[email protected]>
Cc: Nanyong Sun <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Stefan Roesch <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'mm/mm_init.c')
0 files changed, 0 insertions, 0 deletions
