@@ -4481,6 +4481,7 @@ static int isolate_folios(struct lruvec *lruvec, struct scan_control *sc, int sw
int scanned;
int tier = -1;
DEFINE_MIN_SEQ(lruvec);
+ bool stalled = false;
/*
* Try to make the obvious choice first, and if anon and file are both
@@ -4503,6 +4504,16 @@ static int isolate_folios(struct lruvec *lruvec, struct scan_control *sc, int sw
else
type = get_type_to_scan(lruvec, swappiness, &tier);
+ spin_unlock_irq(&lruvec->lru_lock);
+ while (unlikely(too_many_isolated(lruvec_pgdat(lruvec), type, sc))) {
+ if (stalled) {
+ spin_lock_irq(&lruvec->lru_lock);
+ return 0;
+ }
+ reclaim_throttle(lruvec_pgdat(lruvec), VMSCAN_THROTTLE_ISOLATED);
+ }
+ spin_lock_irq(&lruvec->lru_lock);
+
for (i = !swappiness; i < ANON_AND_FILE; i++) {
if (tier < 0)
tier = get_tier_idx(lruvec, type);
@@ -4550,8 +4561,10 @@ static int evict_folios(struct lruvec *lruvec, struct scan_control *sc, int swap
if (list_empty(&list))
return scanned;
retry:
+ __mod_node_page_state(lruvec_pgdat(lruvec), NR_ISOLATED_ANON + type, scanned);
reclaimed = shrink_folio_list(&list, pgdat, sc, &stat, false);
sc->nr_reclaimed += reclaimed;
+ __mod_node_page_state(lruvec_pgdat(lruvec), NR_ISOLATED_ANON + type, -scanned);
trace_mm_vmscan_lru_shrink_inactive(pgdat->node_id,
scanned, reclaimed, &stat, sc->priority,
type ? LRU_INACTIVE_FILE : LRU_INACTIVE_ANON);