Re: [PATCH v3 4/7] per-cgroup tcp buffers control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/26/2011 11:39 AM, Andrew Vagin wrote:
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

Thank you, will fix it

+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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]