From: Li Zefan <lizf@cn.fujitsu.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Balbir Singh <balbir@linux.vnet.ibm.com>,
Paul Menage <menage@google.com>,
Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>,
LKML <linux-kernel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: [PATCH] memcg: fix return value of mem_cgroup_hierarchy_write()
Date: Wed, 14 Jan 2009 16:10:52 +0800 [thread overview]
Message-ID: <496D9E0C.4060806@cn.fujitsu.com> (raw)
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.
Signed-off-by: Li Zefan <lizf@cn.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
WARNING: multiple messages have this Message-ID (diff)
From: Li Zefan <lizf@cn.fujitsu.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Balbir Singh <balbir@linux.vnet.ibm.com>,
Paul Menage <menage@google.com>,
Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>,
LKML <linux-kernel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: [PATCH] memcg: fix return value of mem_cgroup_hierarchy_write()
Date: Wed, 14 Jan 2009 16:10:52 +0800 [thread overview]
Message-ID: <496D9E0C.4060806@cn.fujitsu.com> (raw)
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.
Signed-off-by: Li Zefan <lizf@cn.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, 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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2009-01-14 8:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-14 8:10 Li Zefan [this message]
2009-01-14 8:10 ` [PATCH] memcg: fix return value of mem_cgroup_hierarchy_write() Li Zefan
2009-01-14 8:21 ` KAMEZAWA Hiroyuki
2009-01-14 8:21 ` KAMEZAWA Hiroyuki
2009-01-14 8:29 ` Daisuke Nishimura
2009-01-14 8:29 ` Daisuke Nishimura
2009-01-14 8:38 ` Balbir Singh
2009-01-14 8:38 ` Balbir Singh
2009-01-14 8:45 ` Li Zefan
2009-01-14 8:45 ` Li Zefan
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=496D9E0C.4060806@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=menage@google.com \
--cc=nishimura@mxp.nes.nec.co.jp \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.