linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.cz>, Hillf Danton <dhillf@gmail.com>,
	Hugh Dickins <hughd@google.com>,
	Balbir Singh <bsingharora@gmail.com>,
	David Rientjes <rientjes@google.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] memcg: clean up soft_limit_tree properly new
Date: Wed, 14 Dec 2011 10:16:36 +0900	[thread overview]
Message-ID: <20111214101636.e463405c.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <20111213170012.8fe53c90.akpm@linux-foundation.org>

On Tue, 13 Dec 2011 17:00:12 -0800
Andrew Morton <akpm@linux-foundation.org> wrote:

> On Mon, 12 Dec 2011 15:09:35 +0100
> Michal Hocko <mhocko@suse.cz> wrote:
> 
> > And a follow up patch for the proper clean up:
> > ---
> > >From 4b9f5a1e88496af9f336d1ef37cfdf3754a3ba48 Mon Sep 17 00:00:00 2001
> > From: Michal Hocko <mhocko@suse.cz>
> > Date: Mon, 12 Dec 2011 15:04:18 +0100
> > Subject: [PATCH] memcg: clean up soft_limit_tree properly
> > 
> > If we are not able to allocate tree nodes for all NUMA nodes then we
> > should better clean up those that were allocated otherwise we will leak
> > a memory.
> > 
> > Signed-off-by: Michal Hocko <mhocko@suse.cz>
> > ---
> >  mm/memcontrol.c |   12 +++++++++++-
> >  1 files changed, 11 insertions(+), 1 deletions(-)
> > 
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index 6aff93c..838d812 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -4874,7 +4874,7 @@ static int mem_cgroup_soft_limit_tree_init(void)
> >  			tmp = -1;
> >  		rtpn = kzalloc_node(sizeof(*rtpn), GFP_KERNEL, tmp);
> >  		if (!rtpn)
> > -			return 1;
> > +			goto err_cleanup;
> >  
> >  		soft_limit_tree.rb_tree_per_node[node] = rtpn;
> >  
> > @@ -4885,6 +4885,16 @@ static int mem_cgroup_soft_limit_tree_init(void)
> >  		}
> >  	}
> >  	return 0;
> > +
> > +err_cleanup:
> > +	for_each_node_state(node, N_POSSIBLE) {
> > +		if (!soft_limit_tree.rb_tree_per_node[node])
> > +			break;
> > +		kfree(soft_limit_tree.rb_tree_per_node[node]);
> > +		soft_limit_tree.rb_tree_per_node[node] = NULL;
> > +	}
> > +	return 1;
> > +
> >  }
> 
> afacit the kernel never frees the soft_limit_tree.rb_tree_per_node[]
> entries on the mem_cgroup_destroy() path.  Bug?
> 

soft_limit_tree.rb_tree_per_node[] is a global object and allocated once
at creating root cgroup.

Nodes of rb_tree for a memcg are contained in struct mem_cgroup_per_zone
and it's freed at mem_cgroup_destroy().

Thanks,
-Kame




--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-12-14  1:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-11  1:19 [PATCH] mm: memcg: keep root group unchanged if fail to create new Hillf Danton
2011-12-11 23:39 ` Hugh Dickins
2011-12-12 12:48   ` Hillf Danton
2011-12-12 13:11   ` Michal Hocko
2011-12-12 13:49     ` Hillf Danton
2011-12-12 14:07       ` Michal Hocko
2011-12-12 14:09         ` [PATCH] memcg: clean up soft_limit_tree properly new Michal Hocko
2011-12-13 14:08           ` Johannes Weiner
2011-12-13 14:19             ` Michal Hocko
2011-12-14  1:00           ` Andrew Morton
2011-12-14  1:16             ` KAMEZAWA Hiroyuki [this message]
2011-12-13 14:05       ` [PATCH] mm: memcg: keep root group unchanged if fail to create new Johannes Weiner
2011-12-12  0:52 ` KAMEZAWA Hiroyuki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111214101636.e463405c.kamezawa.hiroyu@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=bsingharora@gmail.com \
    --cc=dhillf@gmail.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox