From c27bb1e5743a03ab1caa0ff45941937d70d3e861 Mon Sep 17 00:00:00 2001 From: Vinayak Menon Date: Fri, 8 May 2015 18:36:52 +0530 Subject: [PATCH] mm: process_reclaim: fix reclaim skip on low efficiency The logic used to skip reclaim on low efficiency results in process reclaim not triggering at all. Fix it by properly handling the skip_reclaim atomic variable. Change-Id: I119097bb9b1baf8f3e8d4afa0a6dc2c30c0de6e7 Signed-off-by: Vinayak Menon --- mm/process_reclaim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/process_reclaim.c b/mm/process_reclaim.c index 7f70a3784d9b..5bc7087f7890 100644 --- a/mm/process_reclaim.c +++ b/mm/process_reclaim.c @@ -208,7 +208,7 @@ static void swap_fn(struct work_struct *work) if (efficiency < swap_opt_eff) { if (++monitor_eff == swap_eff_win) { - atomic_set(&skip_reclaim, swap_eff_win + 1); + atomic_set(&skip_reclaim, swap_eff_win); monitor_eff = 0; } } else { @@ -232,7 +232,7 @@ static int vmpressure_notifier(struct notifier_block *nb, if (!current_is_kswapd()) return 0; - if (!atomic_dec_and_test(&skip_reclaim)) + if (0 <= atomic_dec_if_positive(&skip_reclaim)) return 0; if ((pressure >= pressure_min) && (pressure < pressure_max))