[Devel] [PATCH RHEL7 COMMIT] ms/memcg: use CFTYPE_NOT_ON_ROOT for memory.low and memory.oom_guarantee

Konstantin Khorenko khorenko at virtuozzo.com
Fri May 29 00:55:40 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.7
------>
commit 24dbf07906c8e288ed18f895f49c36dc850213bb
Author: Vladimir Davydov <vdavydov at parallels.com>
Date:   Fri May 29 11:55:40 2015 +0400

    ms/memcg: use CFTYPE_NOT_ON_ROOT for memory.low and memory.oom_guarantee
    
    This is neater than checking if the root is passed to the write method
    and this is how it works upstream (for memory.low).
    
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
    Reviewed-by: Kirill Tkhai <ktkhai at odin.com>
---
 mm/memcontrol.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 63a800c..a0eee75 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5161,9 +5161,6 @@ static int mem_cgroup_low_write(struct cgroup *cont, struct cftype *cft,
 	unsigned long long val;
 	int ret;
 
-	if (mem_cgroup_is_root(memcg))
-		return -EINVAL;
-
 	ret = res_counter_memparse_write_strategy(buffer, &val);
 	if (ret)
 		return ret;
@@ -5191,9 +5188,6 @@ static int mem_cgroup_oom_guarantee_write(struct cgroup *cont,
 	unsigned long long val;
 	int ret;
 
-	if (mem_cgroup_is_root(memcg))
-		return -EINVAL;
-
 	ret = res_counter_memparse_write_strategy(buffer, &val);
 	if (ret)
 		return ret;
@@ -6087,6 +6081,7 @@ static struct cftype mem_cgroup_files[] = {
 	},
 	{
 		.name = "low",
+		.flags = CFTYPE_NOT_ON_ROOT,
 		.write_string = mem_cgroup_low_write,
 		.read = mem_cgroup_low_read,
 	},
@@ -6130,6 +6125,7 @@ static struct cftype mem_cgroup_files[] = {
 	},
 	{
 		.name = "oom_guarantee",
+		.flags = CFTYPE_NOT_ON_ROOT,
 		.write_string = mem_cgroup_oom_guarantee_write,
 		.read = mem_cgroup_oom_guarantee_read,
 	},



More information about the Devel mailing list