Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758161AbZANIbu (ORCPT ); Wed, 14 Jan 2009 03:31:50 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755830AbZANIbl (ORCPT ); Wed, 14 Jan 2009 03:31:41 -0500 Received: from TYO201.gate.nec.co.jp ([202.32.8.193]:61520 "EHLO tyo201.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754536AbZANIbk (ORCPT ); Wed, 14 Jan 2009 03:31:40 -0500 Date: Wed, 14 Jan 2009 17:29:12 +0900 From: Daisuke Nishimura To: Li Zefan Cc: nishimura@mxp.nes.nec.co.jp, Andrew Morton , KAMEZAWA Hiroyuki , Balbir Singh , Paul Menage , LKML , "linux-mm@kvack.org" Subject: Re: [PATCH] memcg: fix return value of mem_cgroup_hierarchy_write() Message-Id: <20090114172912.95a78542.nishimura@mxp.nes.nec.co.jp> In-Reply-To: <496D9E0C.4060806@cn.fujitsu.com> References: <496D9E0C.4060806@cn.fujitsu.com> Organization: NEC Soft, Ltd. X-Mailer: Sylpheed 2.4.8 (GTK+ 2.10.14; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1657 Lines: 51 On Wed, 14 Jan 2009 16:10:52 +0800, Li Zefan wrote: > When there are sub-dirs, writing to memory.use_hierarchy returns -EBUSY, > this doesn't seem to fit the meaning of EBUSY, and is inconsistent with > memory.swappiness, which returns -EINVAL in this case. > I also think -EBUSY is not so bad in this case. Thanks, Daisuke Nishimura. > Signed-off-by: Li Zefan > --- > mm/memcontrol.c | 10 +++++----- > 1 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index bc8f101..2497f7d 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -1760,6 +1760,9 @@ static int mem_cgroup_hierarchy_write(struct cgroup *cont, struct cftype *cft, > struct cgroup *parent = cont->parent; > struct mem_cgroup *parent_mem = NULL; > > + if (val != 0 && val != 1) > + return -EINVAL; > + > if (parent) > parent_mem = mem_cgroup_from_cont(parent); > > @@ -1773,12 +1776,9 @@ static int mem_cgroup_hierarchy_write(struct cgroup *cont, struct cftype *cft, > * set if there are no children. > */ > if ((!parent_mem || !parent_mem->use_hierarchy) && > - (val == 1 || val == 0)) { > - if (list_empty(&cont->children)) > + list_empty(&cont->children)) > mem->use_hierarchy = val; > - else > - retval = -EBUSY; > - } else > + else > retval = -EINVAL; > cgroup_unlock(); > > -- > 1.5.4.rc3 -- 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/