[Devel] [PATCH rh7] mm/memcontrol: Fix mem cgroup usage statistics.
Andrey Ryabinin
aryabinin at virtuozzo.com
Mon Jan 23 02:15:49 PST 2017
mem_cgroup_usage() reports usage in pages for non-root cgroup, and in bytes
otherwise. Make it always in pages and update mem_cgroup_read() caller
which wants result in bytes.
https://jira.sw.ru/browse/PSBM-58993
Fixes: 1af99077c135 ("ms/mm: memcontrol: revert use of root_mem_cgroup res_counter")
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
mm/memcontrol.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index dc83f4e..233f542 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4194,7 +4194,7 @@ static inline u64 mem_cgroup_usage(struct mem_cgroup *memcg, bool swap)
if (swap)
val += mem_cgroup_recursive_stat(memcg, MEM_CGROUP_STAT_SWAP);
- return val << PAGE_SHIFT;
+ return val;
}
void mem_cgroup_fill_meminfo(struct mem_cgroup *memcg, struct meminfo *mi)
@@ -4268,9 +4268,9 @@ static ssize_t mem_cgroup_read(struct cgroup *cont, struct cftype *cft,
switch (MEMFILE_ATTR(cft->private)) {
case RES_USAGE:
if (counter == &memcg->memory)
- val = mem_cgroup_usage(memcg, false);
+ val = mem_cgroup_usage(memcg, false) * PAGE_SIZE;
else if (counter == &memcg->memsw)
- val = mem_cgroup_usage(memcg, true);
+ val = mem_cgroup_usage(memcg, true) * PAGE_SIZE;
else
val = (u64)page_counter_read(counter) * PAGE_SIZE;
break;
--
2.10.2
More information about the Devel
mailing list