diff --git a/mm/vmscan.c b/mm/vmscan.c index 0cc3c1eb15f5..c6962aa5ddb4 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2369,10 +2369,13 @@ out: /* * Scan types proportional to swappiness and * their relative recent reclaim efficiency. - * Make sure we don't miss the last page - * because of a round-off error. + * Make sure we don't miss the last page on + * the offlined memory cgroups because of a + * round-off error. */ - scan = DIV64_U64_ROUND_UP(scan * fraction[file], + scan = mem_cgroup_online(memcg) ? + div64_u64(scan * fraction[file], denominator) : + DIV64_U64_ROUND_UP(scan * fraction[file], denominator); break; case SCAN_FILE: