aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorGlauber Costa <glommer@parallels.com>2012-01-11 21:16:06 -0500
committerDavid S. Miller <davem@davemloft.net>2012-01-12 15:27:59 -0500
commit1398eee08222a038fa5f017900f387e81f6e3ff4 (patch)
tree0ac3e3645b2a71d4c67471ef0c072cfd87c6ff48 /net/ipv4
parentcf778b00e96df6d64f8e21b8395d1f8a859ecdc7 (diff)
net: decrement memcg jump label when limit, not usage, is changed
The logic of the current code is that whenever we destroy a cgroup that had its limit set (set meaning different than maximum), we should decrement the jump_label counter. Otherwise we assume it was never incremented. But what the code actually does is test for RES_USAGE instead of RES_LIMIT. Usage being different than maximum is likely to be true most of the time. The effect of this is that the key must become negative, and since the jump_label test says: !!atomic_read(&key->enabled); we'll have jump_labels still on when no one else is using this functionality. Signed-off-by: Glauber Costa <glommer@parallels.com> CC: David S. Miller <davem@davemloft.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/tcp_memcontrol.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/tcp_memcontrol.c b/net/ipv4/tcp_memcontrol.c
index 7fed04f875c1..49978788a9dc 100644
--- a/net/ipv4/tcp_memcontrol.c
+++ b/net/ipv4/tcp_memcontrol.c
@@ -108,7 +108,7 @@ void tcp_destroy_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss)
108 tcp = tcp_from_cgproto(cg_proto); 108 tcp = tcp_from_cgproto(cg_proto);
109 percpu_counter_destroy(&tcp->tcp_sockets_allocated); 109 percpu_counter_destroy(&tcp->tcp_sockets_allocated);
110 110
111 val = res_counter_read_u64(&tcp->tcp_memory_allocated, RES_USAGE); 111 val = res_counter_read_u64(&tcp->tcp_memory_allocated, RES_LIMIT);
112 112
113 if (val != RESOURCE_MAX) 113 if (val != RESOURCE_MAX)
114 jump_label_dec(&memcg_socket_limit_enabled); 114 jump_label_dec(&memcg_socket_limit_enabled);