mm/mglru: fix underprotected page cache
[platform/kernel/linux-starfive.git] / mm / vmscan.c
index 6f13394..65ef141 100644 (file)
@@ -4933,7 +4933,7 @@ static bool sort_folio(struct lruvec *lruvec, struct folio *folio, struct scan_c
        }
 
        /* protected */
-       if (tier > tier_idx) {
+       if (tier > tier_idx || refs == BIT(LRU_REFS_WIDTH)) {
                int hist = lru_hist_from_seq(lrugen->min_seq[type]);
 
                gen = folio_inc_gen(lruvec, folio, false);