@@ -108,38 +108,28 @@ static void verify_rss_anon_split_huge_page_all_zeroes(char *one_page, int nr_hp
108
108
unsigned long rss_anon_before , rss_anon_after ;
109
109
size_t i ;
110
110
111
- if (!check_huge_anon (one_page , 4 , pmd_pagesize )) {
112
- printf ("No THP is allocated\n" );
113
- exit (EXIT_FAILURE );
114
- }
111
+ if (!check_huge_anon (one_page , 4 , pmd_pagesize ))
112
+ ksft_exit_fail_msg ("No THP is allocated\n" );
115
113
116
114
rss_anon_before = rss_anon ();
117
- if (!rss_anon_before ) {
118
- printf ("No RssAnon is allocated before split\n" );
119
- exit (EXIT_FAILURE );
120
- }
115
+ if (!rss_anon_before )
116
+ ksft_exit_fail_msg ("No RssAnon is allocated before split\n" );
121
117
122
118
/* split all THPs */
123
119
write_debugfs (PID_FMT , getpid (), (uint64_t )one_page ,
124
120
(uint64_t )one_page + len , 0 );
125
121
126
122
for (i = 0 ; i < len ; i ++ )
127
- if (one_page [i ] != (char )0 ) {
128
- printf ("%ld byte corrupted\n" , i );
129
- exit (EXIT_FAILURE );
130
- }
123
+ if (one_page [i ] != (char )0 )
124
+ ksft_exit_fail_msg ("%ld byte corrupted\n" , i );
131
125
132
- if (!check_huge_anon (one_page , 0 , pmd_pagesize )) {
133
- printf ("Still AnonHugePages not split\n" );
134
- exit (EXIT_FAILURE );
135
- }
126
+ if (!check_huge_anon (one_page , 0 , pmd_pagesize ))
127
+ ksft_exit_fail_msg ("Still AnonHugePages not split\n" );
136
128
137
129
rss_anon_after = rss_anon ();
138
- if (rss_anon_after >= rss_anon_before ) {
139
- printf ("Incorrect RssAnon value. Before: %ld After: %ld\n" ,
130
+ if (rss_anon_after >= rss_anon_before )
131
+ ksft_exit_fail_msg ("Incorrect RssAnon value. Before: %ld After: %ld\n" ,
140
132
rss_anon_before , rss_anon_after );
141
- exit (EXIT_FAILURE );
142
- }
143
133
}
144
134
145
135
void split_pmd_zero_pages (void )
@@ -150,7 +140,7 @@ void split_pmd_zero_pages(void)
150
140
151
141
one_page = allocate_zero_filled_hugepage (len );
152
142
verify_rss_anon_split_huge_page_all_zeroes (one_page , nr_hpages , len );
153
- printf ("Split zero filled huge pages successful\n" );
143
+ ksft_test_result_pass ("Split zero filled huge pages successful\n" );
154
144
free (one_page );
155
145
}
156
146
@@ -491,7 +481,7 @@ int main(int argc, char **argv)
491
481
if (argc > 1 )
492
482
optional_xfs_path = argv [1 ];
493
483
494
- ksft_set_plan (3 + 9 );
484
+ ksft_set_plan (4 + 9 );
495
485
496
486
pagesize = getpagesize ();
497
487
pageshift = ffs (pagesize ) - 1 ;
0 commit comments