Skip to content
Snippets Groups Projects
user avatar
Gabriel Krisman Bertazi authored
This introduces three tests:
1) Sanity check soft dirty basic semantics: allocate area, clean, dirty,
check if the SD bit is flipped.
2) Check VMA reuse: validate the VM_SOFTDIRTY usage
3) Check soft-dirty on huge pages

This was motivated by Will Deacon's fix commit 912efa17 ("mm: proc:
Invalidate TLB after clearing soft-dirty page state"). I was tracking the
same issue that he fixed, and this test would have caught it.

Cc: Will Deacon <will@kernel.org>
Signed-off-by: default avatarGabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: default avatarMuhammad Usama Anjum <usama.anjum@collabora.com>
---
Andrew has dropped the V3 of this patch.

Changes in V5:
- Correct indentation of macros
- Tested by reverting 912efa17 and one sub test failed
- Updated the writing values to the memory and added a comment

Changes in V4:
Cosmetic changes
Removed global variables
Replaced ksft_print_msg with ksft_exit_fail_msg to exit the program at
once
Some other minor changes
Correct the authorship of the patch

Tests of soft dirty bit in this patch and in madv_populate.c are
non-overlapping. madv_populate.c has only one soft-dirty bit test in the
context of different advise (MADV_POPULATE_READ and
MADV_POPULATE_WRITE). This new test adds more tests.

Tab width of 8 has been used to align the macros. This alignment may look
odd in shell or email. But it looks alright in editors.

Test output:
TAP version 13
1..5
ok 1 Test test_simple
ok 2 Test test_vma_reuse reused memory location
ok 3 Test test_vma_reuse dirty bit of previous page
ok 4 Test test_hugepage huge page allocation
ok 5 Test test_hugepage huge page dirty bit
 # Totals: pass:5 fail:0 xfail:0 xpass:0 skip:0 error:0

Or

TAP version 13
1..5
ok 1 Test test_simple
ok 2 Test test_vma_reuse reused memory location
ok 3 Test test_vma_reuse dirty bit of previous page
ok 4 # SKIP Test test_hugepage huge page allocation
ok 5 # SKIP Test test_hugepage huge page dirty bit
 # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:2 error:0

Changes in V3:
Move test to selftests/vm
Use kselftest macros
Minor updates to make code more maintainable
Add configurations in config file

V2 of this patch:
https://lore.kernel.org/lkml/20210603151518.2437813-1-krisman@collabora.com/
7e05763c
Name Last commit Last update