[PATCH] memcg: drain all stocks for the cgroup before read usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Kirill A. Shutemov" <kirill@xxxxxxxxxxxxx>

Currently, mem_cgroup_usage() for non-root cgroup returns usage
including stocks.

Let's drain all socks before read resource counter value. It makes
memory{,.memcg}.usage_in_bytes and memory.stat consistent.

Signed-off-by: Kirill A. Shutemov <kirill@xxxxxxxxxxxxx>
---
 mm/memcontrol.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index ebd1e86..e091022 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3943,6 +3943,7 @@ static inline u64 mem_cgroup_usage(struct mem_cgroup *mem, bool swap)
 	u64 val;
 
 	if (!mem_cgroup_is_root(mem)) {
+		drain_all_stock_sync(mem);
 		if (!swap)
 			return res_counter_read_u64(&mem->res, RES_USAGE);
 		else
-- 
1.7.5.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]