Skip to content

Commit 13c9aaf

Browse files
Janne Huttunentorvalds
authored andcommitted
mm/vmstat.c: fix NUMA statistics updates
Scan through the whole array to see if an update is needed. While we're at it, use sizeof() to be safe against any possible type changes in the future. The bug here is that we wouldn't sync per-cpu counters into global ones if there was an update of numa_stats for higher cpus. Highly theoretical one though because it is much more probable that zone_stats are updated so we would refresh anyway. So I wouldn't bother to mark this for stable, yet something nice to fix. [[email protected]: changelog enhancement] Link: http://lkml.kernel.org/r/[email protected] Fixes: 1d90ca8 ("mm: update NUMA counter threshold size") Signed-off-by: Janne Huttunen <[email protected]> Acked-by: Michal Hocko <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 7817955 commit 13c9aaf

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

mm/vmstat.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,12 +1827,13 @@ static bool need_update(int cpu)
18271827

18281828
/*
18291829
* The fast way of checking if there are any vmstat diffs.
1830-
* This works because the diffs are byte sized items.
18311830
*/
1832-
if (memchr_inv(p->vm_stat_diff, 0, NR_VM_ZONE_STAT_ITEMS))
1831+
if (memchr_inv(p->vm_stat_diff, 0, NR_VM_ZONE_STAT_ITEMS *
1832+
sizeof(p->vm_stat_diff[0])))
18331833
return true;
18341834
#ifdef CONFIG_NUMA
1835-
if (memchr_inv(p->vm_numa_stat_diff, 0, NR_VM_NUMA_STAT_ITEMS))
1835+
if (memchr_inv(p->vm_numa_stat_diff, 0, NR_VM_NUMA_STAT_ITEMS *
1836+
sizeof(p->vm_numa_stat_diff[0])))
18361837
return true;
18371838
#endif
18381839
}

0 commit comments

Comments
 (0)