[Devel] [PATCH rh7 2/3] memcg: use CFTYPE_NOT_ON_ROOT for memory.low and memory.oom_guarantee

Kirill Tkhai ktkhai at odin.com
Tue May 26 03:36:35 PDT 2015


В Пн, 25/05/2015 в 17:05 +0300, Vladimir Davydov пишет:
> 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>
> ---
>  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,

I can't find this function in memcontrol.c. Which series this series goes after?

>  	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,
>  	},





More information about the Devel mailing list