diff options
author | Kemi Wang <kemi.wang@intel.com> | 2017-09-08 19:12:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-08 21:26:47 -0400 |
commit | 638032224ed762a29baca1fc37f1168efc2554ae (patch) | |
tree | 41ec4e67d4698b0c3208afd182297882f49ecc1f /mm/vmstat.c | |
parent | 1d90ca897cb05cf38bd62f36756d219e02913b7d (diff) |
mm: consider the number in local CPUs when reading NUMA stats
To avoid deviation, the per cpu number of NUMA stats in
vm_numa_stat_diff[] is included when a user *reads* the NUMA stats.
Since NUMA stats does not be read by users frequently, and kernel does not
need it to make a decision, it will not be a problem to make the readers
more expensive.
Link: http://lkml.kernel.org/r/1503568801-21305-4-git-send-email-kemi.wang@intel.com
Signed-off-by: Kemi Wang <kemi.wang@intel.com>
Reported-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Cc: Aaron Lu <aaron.lu@intel.com>
Cc: Andi Kleen <andi.kleen@intel.com>
Cc: Christopher Lameter <cl@linux.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Tim Chen <tim.c.chen@intel.com>
Cc: Ying Huang <ying.huang@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmstat.c')
-rw-r--r-- | mm/vmstat.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/mm/vmstat.c b/mm/vmstat.c index 153d8129c155..4bb13e72ac97 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
@@ -897,6 +897,10 @@ unsigned long sum_zone_node_page_state(int node, | |||
897 | return count; | 897 | return count; |
898 | } | 898 | } |
899 | 899 | ||
900 | /* | ||
901 | * Determine the per node value of a numa stat item. To avoid deviation, | ||
902 | * the per cpu stat number in vm_numa_stat_diff[] is also included. | ||
903 | */ | ||
900 | unsigned long sum_zone_numa_state(int node, | 904 | unsigned long sum_zone_numa_state(int node, |
901 | enum numa_stat_item item) | 905 | enum numa_stat_item item) |
902 | { | 906 | { |
@@ -905,7 +909,7 @@ unsigned long sum_zone_numa_state(int node, | |||
905 | unsigned long count = 0; | 909 | unsigned long count = 0; |
906 | 910 | ||
907 | for (i = 0; i < MAX_NR_ZONES; i++) | 911 | for (i = 0; i < MAX_NR_ZONES; i++) |
908 | count += zone_numa_state(zones + i, item); | 912 | count += zone_numa_state_snapshot(zones + i, item); |
909 | 913 | ||
910 | return count; | 914 | return count; |
911 | } | 915 | } |
@@ -1536,7 +1540,7 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, | |||
1536 | for (i = 0; i < NR_VM_NUMA_STAT_ITEMS; i++) | 1540 | for (i = 0; i < NR_VM_NUMA_STAT_ITEMS; i++) |
1537 | seq_printf(m, "\n %-12s %lu", | 1541 | seq_printf(m, "\n %-12s %lu", |
1538 | vmstat_text[i + NR_VM_ZONE_STAT_ITEMS], | 1542 | vmstat_text[i + NR_VM_ZONE_STAT_ITEMS], |
1539 | zone_numa_state(zone, i)); | 1543 | zone_numa_state_snapshot(zone, i)); |
1540 | #endif | 1544 | #endif |
1541 | 1545 | ||
1542 | seq_printf(m, "\n pagesets"); | 1546 | seq_printf(m, "\n pagesets"); |
@@ -1792,6 +1796,7 @@ static bool need_update(int cpu) | |||
1792 | #ifdef CONFIG_NUMA | 1796 | #ifdef CONFIG_NUMA |
1793 | BUILD_BUG_ON(sizeof(p->vm_numa_stat_diff[0]) != 2); | 1797 | BUILD_BUG_ON(sizeof(p->vm_numa_stat_diff[0]) != 2); |
1794 | #endif | 1798 | #endif |
1799 | |||
1795 | /* | 1800 | /* |
1796 | * The fast way of checking if there are any vmstat diffs. | 1801 | * The fast way of checking if there are any vmstat diffs. |
1797 | * This works because the diffs are byte sized items. | 1802 | * This works because the diffs are byte sized items. |