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 <[email protected]> --- mm/memcontrol.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 0ca9cdff8c83..144a2720b604 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5192,9 +5192,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; @@ -5222,9 +5219,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; @@ -6118,6 +6112,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, }, @@ -6161,6 +6156,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, }, -- 2.1.4 _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
