diff --git a/mm/vmscan.c b/mm/vmscan.c index f5671facdc51ab7a4260877862794b377cb8ad60..00ed94bfea7843a2f06c7b111f0e47ea0113b235 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4819,9 +4819,12 @@ int do_swapcache_reclaim(unsigned long *swapcache_watermark, for_each_node_state(nid, N_MEMORY) { cond_resched(); - nr_to_reclaim[nid_num] = (swapcache_to_reclaim / (swapcache_total_reclaimable / nr[nid_num])); + nr_to_reclaim[nid_num] = (swapcache_total_reclaimable == 0) ? 0 : + ((swapcache_to_reclaim * nr[nid_num]) / + swapcache_total_reclaimable); reclaim_page_count += reclaim_swapcache_pages_from_list(nid, - &swapcache_list[nid_num], nr_to_reclaim[nid_num], false); + &swapcache_list[nid_num], + nr_to_reclaim[nid_num], false); nid_num++; }