diff --git a/drivers/staging/android/simple_lmk.c b/drivers/staging/android/simple_lmk.c index 55d53f717593..e39c0fc11a59 100644 --- a/drivers/staging/android/simple_lmk.c +++ b/drivers/staging/android/simple_lmk.c @@ -150,7 +150,7 @@ static cputime_t get_kswapd_cputime(void) static void simple_lmk_reclaim_work(struct work_struct *work) { - unsigned long mib_freed = 0; + unsigned long mib_freed, resched_delay_jiffies = 1; cputime_t kswapd_time_now; u64 delta_us; @@ -162,15 +162,15 @@ static void simple_lmk_reclaim_work(struct work_struct *work) kswapd_start_time = kswapd_time_now; mutex_lock(&reclaim_lock); - if (time_after_eq(jiffies, last_reclaim_jiffies + KSWAPD_LMK_EXPIRES)) - mib_freed = do_lmk_reclaim(MIN_FREE_PAGES); + mib_freed = do_lmk_reclaim(MIN_FREE_PAGES); mutex_unlock(&reclaim_lock); if (mib_freed) pr_info("kswapd: freed %lu MiB\n", mib_freed); + resched_delay_jiffies = KSWAPD_LMK_EXPIRES; reschedule: - queue_delayed_work(simple_lmk_wq, &reclaim_work, KSWAPD_LMK_EXPIRES); + queue_delayed_work(simple_lmk_wq, &reclaim_work, resched_delay_jiffies); } void simple_lmk_one_reclaim(void)