mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
memory-hotplug: fix zone stat mismatch
During memory-hotplug, I found NR_ISOLATED_[ANON|FILE] are increasing, causing the kernel to hang. When the system doesn't have enough free pages, it enters reclaim but never reclaim any pages due to too_many_isolated()==true and loops forever. The cause is that when we do memory-hotadd after memory-remove, __zone_pcp_update() clears a zone's ZONE_STAT_ITEMS in setup_pageset() although the vm_stat_diff of all CPUs still have values. In addtion, when we offline all pages of the zone, we reset them in zone_pcp_reset without draining so we loss some zone stat item. Reviewed-by: Wen Congyang <[email protected]> Signed-off-by: Minchan Kim <[email protected]> Cc: Kamezawa Hiroyuki <[email protected]> Cc: Yasuaki Ishimatsu <[email protected]> Cc: KOSAKI Motohiro <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
082708072a
commit
5a88381384
3 changed files with 23 additions and 0 deletions
12
mm/vmstat.c
12
mm/vmstat.c
|
|
@ -495,6 +495,18 @@ void refresh_cpu_vm_stats(int cpu)
|
|||
atomic_long_add(global_diff[i], &vm_stat[i]);
|
||||
}
|
||||
|
||||
void drain_zonestat(struct zone *zone, struct per_cpu_pageset *pset)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++)
|
||||
if (pset->vm_stat_diff[i]) {
|
||||
int v = pset->vm_stat_diff[i];
|
||||
pset->vm_stat_diff[i] = 0;
|
||||
atomic_long_add(v, &zone->vm_stat[i]);
|
||||
atomic_long_add(v, &vm_stat[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NUMA
|
||||
|
|
|
|||
Loading…
Reference in a new issue