lkml.org 
[lkml]   [2009]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] memcg: fix return value of mem_cgroup_hierarchy_write()
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

\
 
 \ /
  Last update: 2009-01-14 09:15    [W:0.038 / U:0.652 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site