]> Git Repo - linux.git/commitdiff
mm: restore node stat checking in /proc/sys/vm/stat_refresh
authorHugh Dickins <[email protected]>
Wed, 5 May 2021 01:37:51 +0000 (18:37 -0700)
committerLinus Torvalds <[email protected]>
Wed, 5 May 2021 18:27:25 +0000 (11:27 -0700)
In v4.7 commit 52b6f46bc163 ("mm: /proc/sys/vm/stat_refresh to force
vmstat update") introduced vmstat_refresh(), with its vmstat underflow
checking; then in v4.8 commit 75ef71840539 ("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 <[email protected]> for tangentially pointing this out.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Hugh Dickins <[email protected]>
Cc: Roman Gushchin <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/vmstat.c

index 49a8456ec079bbf882fbf034e803c993c9557abd..14d0ba4fd46bf1c0840b15227420bbe2f3b57ae1 100644 (file)
@@ -1875,6 +1875,14 @@ int vmstat_refresh(struct ctl_table *table, int write,
                }
        }
 #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)
                return err;
        if (write)
This page took 0.065651 seconds and 4 git commands to generate.