All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] memcg: drain all stocks for the cgroup before read usage
@ 2011-09-04  1:15 ` Kirill A. Shutemov
  0 siblings, 0 replies; 18+ messages in thread
From: Kirill A. Shutemov @ 2011-09-04  1:15 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Balbir Singh, Daisuke Nishimura, KAMEZAWA Hiroyuki, linux-mm,
	linux-kernel, Kirill A. Shutemov

From: "Kirill A. Shutemov" <kirill@shutemov.name>

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@shutemov.name>
---
 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


^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2011-09-08 10:09 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-04  1:15 [PATCH] memcg: drain all stocks for the cgroup before read usage Kirill A. Shutemov
2011-09-04  1:15 ` Kirill A. Shutemov
2011-09-04  7:20 ` Paul Menage
2011-09-04  7:20   ` Paul Menage
2011-09-04 23:59 ` KAMEZAWA Hiroyuki
2011-09-04 23:59   ` KAMEZAWA Hiroyuki
2011-09-05  1:16   ` Daisuke Nishimura
2011-09-05  1:16     ` Daisuke Nishimura
2011-09-07 21:33     ` Kirill A. Shutemov
2011-09-07 21:33       ` Kirill A. Shutemov
2011-09-08  0:19       ` KAMEZAWA Hiroyuki
2011-09-08  0:19         ` KAMEZAWA Hiroyuki
2011-09-08  0:49         ` Kirill A. Shutemov
2011-09-08  0:49           ` Kirill A. Shutemov
2011-09-08  9:21           ` KAMEZAWA Hiroyuki
2011-09-08  9:21             ` KAMEZAWA Hiroyuki
2011-09-08 10:09           ` Johannes Weiner
2011-09-08 10:09             ` Johannes Weiner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.