Commit 76d8cc3c authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds

mm: restore node stat checking in /proc/sys/vm/stat_refresh

In v4.7 commit 52b6f46b ("mm: /proc/sys/vm/stat_refresh to force
vmstat update") introduced vmstat_refresh(), with its vmstat underflow
checking; then in v4.8 commit 75ef7184 ("mm, vmstat: add
infrastructure for per-node vmstats") split NR_VM_NODE_STAT_ITEMS out of
NR_VM_ZONE_STAT_ITEMS without updating vmstat_refresh(): so it has been
missing out much of the vmstat underflow checking ever since.

Reinstate it.

Thanks to Roman Gushchin <guro@fb.com> for tangentially pointing this out.

Link: https://lkml.kernel.org/r/alpine.LSU.2.11.2102251502240.13363@eggly.anvilsSigned-off-by: default avatarHugh Dickins <hughd@google.com>
Cc: Roman Gushchin <guro@fb.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 420be4ed
...@@ -1875,6 +1875,14 @@ int vmstat_refresh(struct ctl_table *table, int write, ...@@ -1875,6 +1875,14 @@ int vmstat_refresh(struct ctl_table *table, int write,
} }
} }
#endif #endif
for (i = 0; i < NR_VM_NODE_STAT_ITEMS; i++) {
val = atomic_long_read(&vm_node_stat[i]);
if (val < 0) {
pr_warn("%s: %s %ld\n",
__func__, node_stat_name(i), val);
err = -EINVAL;
}
}
if (err) if (err)
return err; return err;
if (write) if (write)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment