From 1839defde452c723aeeaa4a747d0f6eff475f179 Mon Sep 17 00:00:00 2001 From: Patrick Daly Date: Tue, 14 Mar 2017 18:30:41 -0700 Subject: [PATCH] mm: vmscan: support equal reclaim for anon and file pages When performing memory reclaim support treating anonymous and file backed pages equally. Swapping anonymous pages out to memory can be efficient enough to justify treating anonymous and file backed pages equally. CRs-Fixed: 648984 Change-Id: I6315b8557020d1e27a34225bb9cefbef1fb43266 Signed-off-by: Liam Mark Signed-off-by: Patrick Daly Signed-off-by: Sudarshan Rajagopalan [swatsrid@codeaurora.org: Fix trivial merge conflicts] Signed-off-by: Swathi Sridhar [isaacm@codeaurora.org: Fix trivial merge conflicts] Signed-off-by: Isaac J. Manjarres --- mm/Kconfig | 9 +++++++++ mm/vmscan.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mm/Kconfig b/mm/Kconfig index a5dae9a7eb51..22e7911403bd 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -616,6 +616,15 @@ config MAX_STACK_SIZE_MB A sane initial value is 80 MB. +config BALANCE_ANON_FILE_RECLAIM + bool "During reclaim treat anon and file backed pages equally" + depends on SWAP + help + When performing memory reclaim treat anonymous and file backed pages + equally. + Swapping anonymous pages out to memory can be efficient enough to justify + treating anonymous and file backed pages equally. + config DEFERRED_STRUCT_PAGE_INIT bool "Defer initialisation of struct pages to kthreads" depends on SPARSEMEM diff --git a/mm/vmscan.c b/mm/vmscan.c index c6659bb758a4..667e713174a3 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2397,7 +2397,8 @@ static void get_scan_count(struct lruvec *lruvec, struct mem_cgroup *memcg, * lruvec even if it has plenty of old anonymous pages unless the * system is under heavy pressure. */ - if (!inactive_list_is_low(lruvec, true, sc, false) && + if (!IS_ENABLED(CONFIG_BALANCE_ANON_FILE_RECLAIM) && + !inactive_list_is_low(lruvec, true, sc, false) && lruvec_lru_size(lruvec, LRU_INACTIVE_FILE, sc->reclaim_idx) >> sc->priority) { scan_balance = SCAN_FILE; goto out;