From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752639Ab1LKXjt (ORCPT ); Sun, 11 Dec 2011 18:39:49 -0500 Received: from mail-iy0-f174.google.com ([209.85.210.174]:54603 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752566Ab1LKXjs (ORCPT ); Sun, 11 Dec 2011 18:39:48 -0500 Date: Sun, 11 Dec 2011 15:39:43 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@eggly To: Hillf Danton cc: Balbir Singh , David Rientjes , Andrea Arcangeli , Andrew Morton , Johannes Weiner , Michal Hocko , KAMEZAWA Hiroyuki , linux-mm@kvack.org, LKML Subject: Re: [PATCH] mm: memcg: keep root group unchanged if fail to create new In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (LSU 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 11 Dec 2011, Hillf Danton wrote: > If the request is not to create root group and we fail to meet it, > we'd leave the root unchanged. I didn't understand that at first: please say "we should" rather than "we'd", which I take to be an abbreviation for "we would". > > Signed-off-by: Hillf Danton Yes indeed, well caught: Acked-by: Hugh Dickins I wonder what was going through the author's mind when he wrote it that way? I wonder if it's one of those bugs that creeps in when you start from a perfectly functional patch, then make refinements to suit feedback from reviewers. On which topic: wouldn't this patch be better just to move the "root_mem_cgroup = memcg;" two lines lower down (and of course remove free_out's "root_mem_cgroup = NULL;" as you already did)? I can't see mem_cgroup_soft_limit_tree_init() relying on root_mem_cgroup at all. Should your patch go to stable, even to 2.6.32-longterm? Matter of taste, really: while it's not quite impossible for alloc_mem_cgroup_per_zone_info() to fail, it is very unlikely. > --- > > --- a/mm/memcontrol.c Fri Dec 9 21:57:40 2011 > +++ b/mm/memcontrol.c Sun Dec 11 09:04:48 2011 > @@ -4849,8 +4849,10 @@ mem_cgroup_create(struct cgroup_subsys * > enable_swap_cgroup(); > parent = NULL; > root_mem_cgroup = memcg; > - if (mem_cgroup_soft_limit_tree_init()) > + if (mem_cgroup_soft_limit_tree_init()) { > + root_mem_cgroup = NULL; > goto free_out; > + } > for_each_possible_cpu(cpu) { > struct memcg_stock_pcp *stock = > &per_cpu(memcg_stock, cpu); > @@ -4888,7 +4890,6 @@ mem_cgroup_create(struct cgroup_subsys * > return &memcg->css; > free_out: > __mem_cgroup_free(memcg); > - root_mem_cgroup = NULL; > return ERR_PTR(error); > } >