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>
This commit is contained in:
Vinayak Menon 2015-05-08 18:36:52 +05:30
parent d73bebc75f
commit c27bb1e574

View file

@ -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))