|
@@ -2361,8 +2361,10 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
|
|
|
aborted_reclaim = shrink_zones(zonelist, sc);
|
|
|
|
|
|
/*
|
|
|
- * Don't shrink slabs when reclaiming memory from
|
|
|
- * over limit cgroups
|
|
|
+ * Don't shrink slabs when reclaiming memory from over limit
|
|
|
+ * cgroups but do shrink slab at least once when aborting
|
|
|
+ * reclaim for compaction to avoid unevenly scanning file/anon
|
|
|
+ * LRU pages over slab pages.
|
|
|
*/
|
|
|
if (global_reclaim(sc)) {
|
|
|
unsigned long lru_pages = 0;
|
|
@@ -2404,7 +2406,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
|
|
|
WB_REASON_TRY_TO_FREE_PAGES);
|
|
|
sc->may_writepage = 1;
|
|
|
}
|
|
|
- } while (--sc->priority >= 0);
|
|
|
+ } while (--sc->priority >= 0 && !aborted_reclaim);
|
|
|
|
|
|
out:
|
|
|
delayacct_freepages_end();
|