The patch titled Subject: memcg, vmscan: Fix forced scan of anonymous pages has been added to the -mm tree. Its filename is memcg-vmscan-fix-forced-scan-of-anonymous-pages.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/memcg-vmscan-fix-forced-scan-of-anonymous-pages.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/memcg-vmscan-fix-forced-scan-of-anonymous-pages.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: "Jerome Marchand" <jmarchan@xxxxxxxxxx> Subject: memcg, vmscan: Fix forced scan of anonymous pages When memory cgoups are enabled, the code that decides to force to scan anonymous pages in get_scan_count() compares global values (free, high_watermark) to a value that is restricted to a memory cgroup (file). It make the code over-eager to force anon scan. For instance, it will force anon scan when scanning a memcg that is mainly populated by anonymous page, even when there is plenty of file pages to get rid of in others memcgs, even when swappiness == 0. It breaks user's expectation about swappiness and hurts performance. This patch makes sure that forced anon scan only happens when there not enough file pages for the all zone, not just in one random memcg. Signed-off-by: Jerome Marchand <jmarchan@xxxxxxxxxx> Acked-by: Michal Hocko <mhocko@xxxxxxx> Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx> Reviewed-by: Rik van Riel <riel@xxxxxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/vmscan.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff -puN mm/vmscan.c~memcg-vmscan-fix-forced-scan-of-anonymous-pages mm/vmscan.c --- a/mm/vmscan.c~memcg-vmscan-fix-forced-scan-of-anonymous-pages +++ a/mm/vmscan.c @@ -1950,8 +1950,11 @@ static void get_scan_count(struct lruvec */ if (global_reclaim(sc)) { unsigned long free = zone_page_state(zone, NR_FREE_PAGES); + unsigned long zonefile = + zone_page_state(zone, NR_LRU_BASE + LRU_ACTIVE_FILE) + + zone_page_state(zone, NR_LRU_BASE + LRU_INACTIVE_FILE); - if (unlikely(file + free <= high_wmark_pages(zone))) { + if (unlikely(zonefile + free <= high_wmark_pages(zone))) { scan_balance = SCAN_ANON; goto out; } _ Patches currently in -mm which might be from jmarchan@xxxxxxxxxx are mm-make-copy_pte_range-static-again.patch mm-vmscan-fix-an-outdated-comment-still-mentioning-get_scan_ratio.patch memcg-vmscan-fix-forced-scan-of-anonymous-pages.patch zram-use-size_t-instead-of-u16.patch zram-remove-global-tb_lock-with-fine-grain-lock.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html