lkml.org 
[lkml]   [2011]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 4/7] per-cgroup tcp buffers control
We can't change net.ipv4.tcp_mem if a cgroup with memory controller 
isn't mounted.

[root@dhcp-10-30-20-19 ~]# sysctl -w net.ipv4.tcp_mem="3 2 3"
error: "Invalid argument" setting key "net.ipv4.tcp_mem"

It's because tcp_max_memory is initialized in mem_cgroup_populate:

mem_cgroup_populate->register_kmem_files->sockets_populate->tcp_init_cgroup

> +int sockets_populate(struct cgroup *cgrp, struct cgroup_subsys *ss)
> +{
> + struct proto *proto;
> + int ret = 0;
> +
> + read_lock(&proto_list_lock);
> + list_for_each_entry(proto,&proto_list, node) {
> + if (proto->init_cgroup)
> + ret |= proto->init_cgroup(proto, cgrp, ss);
> + }
> + if (!ret)
> + goto out;
> +
> + list_for_each_entry_continue_reverse(proto,&proto_list, node)
> + if (proto->destroy_cgroup)
> + proto->destroy_cgroup(proto, cgrp, ss);
> +
> +out:
> + read_unlock(&proto_list_lock);
> + return ret;
> +}

> @@ -198,6 +203,21 @@ static int ipv4_tcp_mem(ctl_table *ctl, int write,
> if (ret)
> return ret;
>
> +#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM
> + rcu_read_lock();
> + cg = mem_cgroup_from_task(current);
> + for (i = 0; i< 3; i++)
> + if (vec[i]> tcp_max_memory(cg)) {
> + rcu_read_unlock();
> + return -EINVAL;
> + }



\
 
 \ /
  Last update: 2011-09-26 16:43    [W:0.334 / U:0.896 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site