* [PATCH] net: decrement memcg jump label when limit, not usage, is changed
@ 2012-01-12 12:16 Glauber Costa
2012-01-12 20:28 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Glauber Costa @ 2012-01-12 12:16 UTC (permalink / raw)
To: davem; +Cc: linux-kernel, netdev, cgroups, Glauber Costa
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>
---
net/ipv4/tcp_memcontrol.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/ipv4/tcp_memcontrol.c b/net/ipv4/tcp_memcontrol.c
index 7fed04f..4997878 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)
tcp = tcp_from_cgproto(cg_proto);
percpu_counter_destroy(&tcp->tcp_sockets_allocated);
- val = res_counter_read_u64(&tcp->tcp_memory_allocated, RES_USAGE);
+ val = res_counter_read_u64(&tcp->tcp_memory_allocated, RES_LIMIT);
if (val != RESOURCE_MAX)
jump_label_dec(&memcg_socket_limit_enabled);
--
1.7.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: decrement memcg jump label when limit, not usage, is changed
2012-01-12 12:16 [PATCH] net: decrement memcg jump label when limit, not usage, is changed Glauber Costa
@ 2012-01-12 20:28 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-01-12 20:28 UTC (permalink / raw)
To: glommer; +Cc: linux-kernel, netdev, cgroups
From: Glauber Costa <glommer@parallels.com>
Date: Thu, 12 Jan 2012 16:16:06 +0400
> 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>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-12 20:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-12 12:16 [PATCH] net: decrement memcg jump label when limit, not usage, is changed Glauber Costa
2012-01-12 20:28 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).