[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4E808EA6.4000301@gmail.com>
Date: Mon, 26 Sep 2011 18:39:34 +0400
From: Andrew Vagin <avagin@...il.com>
To: Glauber Costa <glommer@...allels.com>
CC: linux-kernel@...r.kernel.org, paul@...lmenage.org,
lizf@...fujitsu.com, kamezawa.hiroyu@...fujitsu.com,
ebiederm@...ssion.com, davem@...emloft.net, gthelen@...gle.com,
netdev@...r.kernel.org, linux-mm@...ck.org, kirill@...temov.name
Subject: Re: [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@...p-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;
> + }
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists