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 <vinmenon@codeaurora.org>
diff --git a/mm/process_reclaim.c b/mm/process_reclaim.c
index adba473..a92daf8 100644
--- a/mm/process_reclaim.c
+++ b/mm/process_reclaim.c
@@ -206,7 +206,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 {
@@ -230,7 +230,7 @@ static int vmpressure_notifier(struct notifier_block *nb,
 	if (!current_is_kswapd())
 		return 0;
 
-	if (!atomic_dec_and_test(&skip_reclaim))
+	if (atomic_dec_if_positive(&skip_reclaim) >= 0)
 		return 0;
 
 	if ((pressure >= pressure_min) && (pressure < pressure_max))