Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755772Ab2FYSeu (ORCPT ); Mon, 25 Jun 2012 14:34:50 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:63634 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753684Ab2FYSer (ORCPT ); Mon, 25 Jun 2012 14:34:47 -0400 Date: Mon, 25 Jun 2012 11:34:42 -0700 From: Tejun Heo To: Glauber Costa Cc: cgroups@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , linux-kernel@vger.kernel.org, Frederic Weisbecker , David Rientjes , Pekka Enberg , Michal Hocko , Johannes Weiner , Christoph Lameter , devel@openvz.org, kamezawa.hiroyu@jp.fujitsu.com, Pekka Enberg , Suleiman Souhlal Subject: Re: [PATCH 10/11] memcg: allow a memcg with kmem charges to be destructed. Message-ID: <20120625183442.GG3869@google.com> References: <1340633728-12785-1-git-send-email-glommer@parallels.com> <1340633728-12785-11-git-send-email-glommer@parallels.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1340633728-12785-11-git-send-email-glommer@parallels.com> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1833 Lines: 48 On Mon, Jun 25, 2012 at 06:15:27PM +0400, Glauber Costa wrote: > Because the ultimate goal of the kmem tracking in memcg is to > track slab pages as well, we can't guarantee that we'll always > be able to point a page to a particular process, and migrate > the charges along with it - since in the common case, a page > will contain data belonging to multiple processes. > > Because of that, when we destroy a memcg, we only make sure > the destruction will succeed by discounting the kmem charges > from the user charges when we try to empty the cgroup. > > Signed-off-by: Glauber Costa > CC: Christoph Lameter > CC: Pekka Enberg > CC: Michal Hocko > CC: Kamezawa Hiroyuki > CC: Johannes Weiner > CC: Suleiman Souhlal > --- > mm/memcontrol.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index a6a440b..bb9b6fe 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -598,6 +598,11 @@ static void disarm_kmem_keys(struct mem_cgroup *memcg) > { > if (test_bit(KMEM_ACCOUNTED_THIS, &memcg->kmem_accounted)) > static_key_slow_dec(&mem_cgroup_kmem_enabled_key); > + /* > + * This check can't live in kmem destruction function, > + * since the charges will outlive the cgroup > + */ > + BUG_ON(res_counter_read_u64(&memcg->kmem, RES_USAGE) != 0); WARN_ON() please. Misaccounted kernel usually is better than dead kernel. Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/