File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -335,6 +335,7 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd,
335
335
struct folio * folio = NULL ;
336
336
LIST_HEAD (folio_list );
337
337
bool pageout_anon_only_filter ;
338
+ unsigned int batch_count = 0 ;
338
339
339
340
if (fatal_signal_pending (current ))
340
341
return - EINTR ;
@@ -416,6 +417,7 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd,
416
417
regular_folio :
417
418
#endif
418
419
tlb_change_page_size (tlb , PAGE_SIZE );
420
+ restart :
419
421
start_pte = pte = pte_offset_map_lock (vma -> vm_mm , pmd , addr , & ptl );
420
422
if (!start_pte )
421
423
return 0 ;
@@ -424,6 +426,15 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd,
424
426
for (; addr < end ; pte ++ , addr += PAGE_SIZE ) {
425
427
ptent = ptep_get (pte );
426
428
429
+ if (++ batch_count == SWAP_CLUSTER_MAX ) {
430
+ batch_count = 0 ;
431
+ if (need_resched ()) {
432
+ pte_unmap_unlock (start_pte , ptl );
433
+ cond_resched ();
434
+ goto restart ;
435
+ }
436
+ }
437
+
427
438
if (pte_none (ptent ))
428
439
continue ;
429
440
You can’t perform that action at this time.
0 commit comments