Skip to content

Commit ce1c082

Browse files
lorenzo-stoakesakpm00
authored andcommitted
selftests/mm: rename guard-pages to guard-regions
The feature formerly referred to as guard pages is more correctly referred to as 'guard regions', as in fact no pages are ever allocated in the process of installing the regions. To avoid confusion, rename the tests accordingly. [[email protected]: fix guard regions invocation] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/1c3cd04a3f69b5756b94bda701ac88325a9be18b.1739469950.git.lorenzo.stoakes@oracle.com Signed-off-by: Lorenzo Stoakes <[email protected]> Acked-by: Vlastimil Babka <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Jann Horn <[email protected]> Cc: John Hubbard <[email protected]> Cc: Kalesh Singh <[email protected]> Cc: Liam Howlett <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: "Paul E . McKenney" <[email protected]> Cc: Shuah Khan <[email protected]> Cc: Suren Baghdasaryan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent f807123 commit ce1c082

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

tools/testing/selftests/mm/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ droppable
5757
hugetlb_dio
5858
pkey_sighandler_tests_32
5959
pkey_sighandler_tests_64
60-
guard-pages
60+
guard-regions

tools/testing/selftests/mm/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ TEST_GEN_FILES += hugetlb_fault_after_madv
9797
TEST_GEN_FILES += hugetlb_madv_vs_map
9898
TEST_GEN_FILES += hugetlb_dio
9999
TEST_GEN_FILES += droppable
100-
TEST_GEN_FILES += guard-pages
100+
TEST_GEN_FILES += guard-regions
101101

102102
ifneq ($(ARCH),arm64)
103103
TEST_GEN_FILES += soft-dirty

tools/testing/selftests/mm/guard-pages.c renamed to tools/testing/selftests/mm/guard-regions.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ static bool try_read_write_buf(char *ptr)
107107
return try_read_buf(ptr) && try_write_buf(ptr);
108108
}
109109

110-
FIXTURE(guard_pages)
110+
FIXTURE(guard_regions)
111111
{
112112
unsigned long page_size;
113113
};
114114

115-
FIXTURE_SETUP(guard_pages)
115+
FIXTURE_SETUP(guard_regions)
116116
{
117117
struct sigaction act = {
118118
.sa_handler = &handle_fatal,
@@ -126,7 +126,7 @@ FIXTURE_SETUP(guard_pages)
126126
self->page_size = (unsigned long)sysconf(_SC_PAGESIZE);
127127
};
128128

129-
FIXTURE_TEARDOWN(guard_pages)
129+
FIXTURE_TEARDOWN(guard_regions)
130130
{
131131
struct sigaction act = {
132132
.sa_handler = SIG_DFL,
@@ -137,7 +137,7 @@ FIXTURE_TEARDOWN(guard_pages)
137137
sigaction(SIGSEGV, &act, NULL);
138138
}
139139

140-
TEST_F(guard_pages, basic)
140+
TEST_F(guard_regions, basic)
141141
{
142142
const unsigned long NUM_PAGES = 10;
143143
const unsigned long page_size = self->page_size;
@@ -231,7 +231,7 @@ TEST_F(guard_pages, basic)
231231
}
232232

233233
/* Assert that operations applied across multiple VMAs work as expected. */
234-
TEST_F(guard_pages, multi_vma)
234+
TEST_F(guard_regions, multi_vma)
235235
{
236236
const unsigned long page_size = self->page_size;
237237
char *ptr_region, *ptr, *ptr1, *ptr2, *ptr3;
@@ -367,7 +367,7 @@ TEST_F(guard_pages, multi_vma)
367367
* Assert that batched operations performed using process_madvise() work as
368368
* expected.
369369
*/
370-
TEST_F(guard_pages, process_madvise)
370+
TEST_F(guard_regions, process_madvise)
371371
{
372372
const unsigned long page_size = self->page_size;
373373
pid_t pid = getpid();
@@ -467,7 +467,7 @@ TEST_F(guard_pages, process_madvise)
467467
}
468468

469469
/* Assert that unmapping ranges does not leave guard markers behind. */
470-
TEST_F(guard_pages, munmap)
470+
TEST_F(guard_regions, munmap)
471471
{
472472
const unsigned long page_size = self->page_size;
473473
char *ptr, *ptr_new1, *ptr_new2;
@@ -505,7 +505,7 @@ TEST_F(guard_pages, munmap)
505505
}
506506

507507
/* Assert that mprotect() operations have no bearing on guard markers. */
508-
TEST_F(guard_pages, mprotect)
508+
TEST_F(guard_regions, mprotect)
509509
{
510510
const unsigned long page_size = self->page_size;
511511
char *ptr;
@@ -553,7 +553,7 @@ TEST_F(guard_pages, mprotect)
553553
}
554554

555555
/* Split and merge VMAs and make sure guard pages still behave. */
556-
TEST_F(guard_pages, split_merge)
556+
TEST_F(guard_regions, split_merge)
557557
{
558558
const unsigned long page_size = self->page_size;
559559
char *ptr, *ptr_new;
@@ -684,7 +684,7 @@ TEST_F(guard_pages, split_merge)
684684
}
685685

686686
/* Assert that MADV_DONTNEED does not remove guard markers. */
687-
TEST_F(guard_pages, dontneed)
687+
TEST_F(guard_regions, dontneed)
688688
{
689689
const unsigned long page_size = self->page_size;
690690
char *ptr;
@@ -737,7 +737,7 @@ TEST_F(guard_pages, dontneed)
737737
}
738738

739739
/* Assert that mlock()'ed pages work correctly with guard markers. */
740-
TEST_F(guard_pages, mlock)
740+
TEST_F(guard_regions, mlock)
741741
{
742742
const unsigned long page_size = self->page_size;
743743
char *ptr;
@@ -810,7 +810,7 @@ TEST_F(guard_pages, mlock)
810810
*
811811
* - Moving a mapping alone should retain markers as they are.
812812
*/
813-
TEST_F(guard_pages, mremap_move)
813+
TEST_F(guard_regions, mremap_move)
814814
{
815815
const unsigned long page_size = self->page_size;
816816
char *ptr, *ptr_new;
@@ -857,7 +857,7 @@ TEST_F(guard_pages, mremap_move)
857857
* will have to remove guard pages manually to fix up (they'd have to do the
858858
* same if it were a PROT_NONE mapping).
859859
*/
860-
TEST_F(guard_pages, mremap_expand)
860+
TEST_F(guard_regions, mremap_expand)
861861
{
862862
const unsigned long page_size = self->page_size;
863863
char *ptr, *ptr_new;
@@ -920,7 +920,7 @@ TEST_F(guard_pages, mremap_expand)
920920
* if the user were using a PROT_NONE mapping they'd have to manually fix this
921921
* up also so this is OK.
922922
*/
923-
TEST_F(guard_pages, mremap_shrink)
923+
TEST_F(guard_regions, mremap_shrink)
924924
{
925925
const unsigned long page_size = self->page_size;
926926
char *ptr;
@@ -984,7 +984,7 @@ TEST_F(guard_pages, mremap_shrink)
984984
* Assert that forking a process with VMAs that do not have VM_WIPEONFORK set
985985
* retain guard pages.
986986
*/
987-
TEST_F(guard_pages, fork)
987+
TEST_F(guard_regions, fork)
988988
{
989989
const unsigned long page_size = self->page_size;
990990
char *ptr;
@@ -1039,7 +1039,7 @@ TEST_F(guard_pages, fork)
10391039
* Assert expected behaviour after we fork populated ranges of anonymous memory
10401040
* and then guard and unguard the range.
10411041
*/
1042-
TEST_F(guard_pages, fork_cow)
1042+
TEST_F(guard_regions, fork_cow)
10431043
{
10441044
const unsigned long page_size = self->page_size;
10451045
char *ptr;
@@ -1110,7 +1110,7 @@ TEST_F(guard_pages, fork_cow)
11101110
* Assert that forking a process with VMAs that do have VM_WIPEONFORK set
11111111
* behave as expected.
11121112
*/
1113-
TEST_F(guard_pages, fork_wipeonfork)
1113+
TEST_F(guard_regions, fork_wipeonfork)
11141114
{
11151115
const unsigned long page_size = self->page_size;
11161116
char *ptr;
@@ -1160,7 +1160,7 @@ TEST_F(guard_pages, fork_wipeonfork)
11601160
}
11611161

11621162
/* Ensure that MADV_FREE retains guard entries as expected. */
1163-
TEST_F(guard_pages, lazyfree)
1163+
TEST_F(guard_regions, lazyfree)
11641164
{
11651165
const unsigned long page_size = self->page_size;
11661166
char *ptr;
@@ -1196,7 +1196,7 @@ TEST_F(guard_pages, lazyfree)
11961196
}
11971197

11981198
/* Ensure that MADV_POPULATE_READ, MADV_POPULATE_WRITE behave as expected. */
1199-
TEST_F(guard_pages, populate)
1199+
TEST_F(guard_regions, populate)
12001200
{
12011201
const unsigned long page_size = self->page_size;
12021202
char *ptr;
@@ -1222,7 +1222,7 @@ TEST_F(guard_pages, populate)
12221222
}
12231223

12241224
/* Ensure that MADV_COLD, MADV_PAGEOUT do not remove guard markers. */
1225-
TEST_F(guard_pages, cold_pageout)
1225+
TEST_F(guard_regions, cold_pageout)
12261226
{
12271227
const unsigned long page_size = self->page_size;
12281228
char *ptr;
@@ -1268,7 +1268,7 @@ TEST_F(guard_pages, cold_pageout)
12681268
}
12691269

12701270
/* Ensure that guard pages do not break userfaultd. */
1271-
TEST_F(guard_pages, uffd)
1271+
TEST_F(guard_regions, uffd)
12721272
{
12731273
const unsigned long page_size = self->page_size;
12741274
int uffd;

tools/testing/selftests/mm/run_vmtests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ CATEGORY="mremap" run_test ./mremap_dontunmap
395395
CATEGORY="hmm" run_test bash ./test_hmm.sh smoke
396396

397397
# MADV_GUARD_INSTALL and MADV_GUARD_REMOVE tests
398-
CATEGORY="madv_guard" run_test ./guard-pages
398+
CATEGORY="madv_guard" run_test ./guard-regions
399399

400400
# MADV_POPULATE_READ and MADV_POPULATE_WRITE tests
401401
CATEGORY="madv_populate" run_test ./madv_populate

0 commit comments

Comments
 (0)