diff options
author | Yafang Shao <laoar.shao@gmail.com> | 2019-07-11 23:52:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-12 14:05:40 -0400 |
commit | dd9239900e12db84c198855b262ae7796db1123b (patch) | |
tree | bf8961375e2bbb9777080944f6105acf6b248fc2 /mm/memcontrol.c | |
parent | 9bd3bb6703d8c0a5fb8aec8e3287bd55b7341dcd (diff) |
mm/memcontrol: fix wrong statistics in memory.stat
When we calculate total statistics for memcg1_stats and memcg1_events,
we use the the index 'i' in the for loop as the events index. Actually
we should use memcg1_stats[i] and memcg1_events[i] as the events index.
Link: http://lkml.kernel.org/r/1562116978-19539-1-git-send-email-laoar.shao@gmail.com
Fixes: 42a300353577 ("mm: memcontrol: fix recursive statistics correctness & scalabilty").
Signed-off-by: Yafang Shao <laoar.shao@gmail.com
Reviewed-by: Shakeel Butt <shakeelb@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Yafang Shao <shaoyafang@didiglobal.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index ba9138a4a1de..591eafafbd8c 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -3530,12 +3530,13 @@ static int memcg_stat_show(struct seq_file *m, void *v) | |||
3530 | if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account()) | 3530 | if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account()) |
3531 | continue; | 3531 | continue; |
3532 | seq_printf(m, "total_%s %llu\n", memcg1_stat_names[i], | 3532 | seq_printf(m, "total_%s %llu\n", memcg1_stat_names[i], |
3533 | (u64)memcg_page_state(memcg, i) * PAGE_SIZE); | 3533 | (u64)memcg_page_state(memcg, memcg1_stats[i]) * |
3534 | PAGE_SIZE); | ||
3534 | } | 3535 | } |
3535 | 3536 | ||
3536 | for (i = 0; i < ARRAY_SIZE(memcg1_events); i++) | 3537 | for (i = 0; i < ARRAY_SIZE(memcg1_events); i++) |
3537 | seq_printf(m, "total_%s %llu\n", memcg1_event_names[i], | 3538 | seq_printf(m, "total_%s %llu\n", memcg1_event_names[i], |
3538 | (u64)memcg_events(memcg, i)); | 3539 | (u64)memcg_events(memcg, memcg1_events[i])); |
3539 | 3540 | ||
3540 | for (i = 0; i < NR_LRU_LISTS; i++) | 3541 | for (i = 0; i < NR_LRU_LISTS; i++) |
3541 | seq_printf(m, "total_%s %llu\n", mem_cgroup_lru_names[i], | 3542 | seq_printf(m, "total_%s %llu\n", mem_cgroup_lru_names[i], |