@@ -392,18 +392,14 @@ void reset_isolation_suitable(pg_data_t *pgdat)
392
392
* Sets the pageblock skip bit if it was clear. Note that this is a hint as
393
393
* locks are not required for read/writers. Returns true if it was already set.
394
394
*/
395
- static bool test_and_set_skip (struct compact_control * cc , struct page * page ,
396
- unsigned long pfn )
395
+ static bool test_and_set_skip (struct compact_control * cc , struct page * page )
397
396
{
398
397
bool skip ;
399
398
400
- /* Do no update if skip hint is being ignored */
399
+ /* Do not update if skip hint is being ignored */
401
400
if (cc -> ignore_skip_hint )
402
401
return false;
403
402
404
- if (!pageblock_aligned (pfn ))
405
- return false;
406
-
407
403
skip = get_pageblock_skip (page );
408
404
if (!skip && !cc -> no_set_skip_hint )
409
405
set_pageblock_skip (page );
@@ -470,8 +466,7 @@ static void update_cached_migrate(struct compact_control *cc, unsigned long pfn)
470
466
{
471
467
}
472
468
473
- static bool test_and_set_skip (struct compact_control * cc , struct page * page ,
474
- unsigned long pfn )
469
+ static bool test_and_set_skip (struct compact_control * cc , struct page * page )
475
470
{
476
471
return false;
477
472
}
@@ -1074,11 +1069,17 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
1074
1069
1075
1070
lruvec_memcg_debug (lruvec , page_folio (page ));
1076
1071
1077
- /* Try get exclusive access under lock */
1078
- if (!skip_updated ) {
1072
+ /*
1073
+ * Try get exclusive access under lock. If marked for
1074
+ * skip, the scan is aborted unless the current context
1075
+ * is a rescan to reach the end of the pageblock.
1076
+ */
1077
+ if (!skip_updated && valid_page ) {
1079
1078
skip_updated = true;
1080
- if (test_and_set_skip (cc , page , low_pfn ))
1079
+ if (test_and_set_skip (cc , valid_page ) &&
1080
+ !cc -> finish_pageblock ) {
1081
1081
goto isolate_abort ;
1082
+ }
1082
1083
}
1083
1084
1084
1085
/*
0 commit comments