[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090114172138.d73a8be8.kamezawa.hiroyu@jp.fujitsu.com>
Date: Wed, 14 Jan 2009 17:21:38 +0900
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To: Li Zefan <lizf@...fujitsu.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Balbir Singh <balbir@...ux.vnet.ibm.com>,
Paul Menage <menage@...gle.com>,
Daisuke Nishimura <nishimura@....nes.nec.co.jp>,
LKML <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>
Subject: Re: [PATCH] memcg: fix return value of mem_cgroup_hierarchy_write()
On Wed, 14 Jan 2009 16:10:52 +0800
Li Zefan <lizf@...fujitsu.com> 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.
>
Hmm...I'm not sure what error code is the best.
In usual, -EINVAL means parameter to write() is bad. In this case, it isn't.
Considering that, -EBUSY seems ok at returning error because of children.
How about change swappiness to return -EBUSY ?
Thanks,
-Kame
> Signed-off-by: Li Zefan <lizf@...fujitsu.com>
> ---
> 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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists