diff options
author | Johannes Weiner <hannes@cmpxchg.org> | 2016-01-14 18:21:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-14 19:00:49 -0500 |
commit | 80f23124f57c77915a7b4201d8dcba38a38b23f0 (patch) | |
tree | d370c585d71dc17fc9b48034cdcda5b6e1b36b22 /include/net | |
parent | af95d7df4059cfeab7e7c244f3564214aada7dad (diff) |
net: tcp_memcontrol: simplify the per-memcg limit access
tcp_memcontrol replicates the global sysctl_mem limit array per cgroup,
but it only ever sets these entries to the value of the memory_allocated
page_counter limit. Use the latter directly.
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/sock.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 1f15937ec208..8b1f8e5d3a48 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1162,10 +1162,12 @@ static inline void sk_enter_memory_pressure(struct sock *sk) | |||
1162 | 1162 | ||
1163 | static inline long sk_prot_mem_limits(const struct sock *sk, int index) | 1163 | static inline long sk_prot_mem_limits(const struct sock *sk, int index) |
1164 | { | 1164 | { |
1165 | long *prot = sk->sk_prot->sysctl_mem; | 1165 | long limit = sk->sk_prot->sysctl_mem[index]; |
1166 | |||
1166 | if (mem_cgroup_sockets_enabled && sk->sk_cgrp) | 1167 | if (mem_cgroup_sockets_enabled && sk->sk_cgrp) |
1167 | prot = sk->sk_cgrp->sysctl_mem; | 1168 | limit = min_t(long, limit, sk->sk_cgrp->memory_allocated.limit); |
1168 | return prot[index]; | 1169 | |
1170 | return limit; | ||
1169 | } | 1171 | } |
1170 | 1172 | ||
1171 | static inline void memcg_memory_allocated_add(struct cg_proto *prot, | 1173 | static inline void memcg_memory_allocated_add(struct cg_proto *prot, |