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>
This commit is contained in:

committed by
Linus Torvalds

parent
af95d7df40
commit
80f23124f5
@@ -1162,10 +1162,12 @@ static inline void sk_enter_memory_pressure(struct sock *sk)
|
||||
|
||||
static inline long sk_prot_mem_limits(const struct sock *sk, int index)
|
||||
{
|
||||
long *prot = sk->sk_prot->sysctl_mem;
|
||||
long limit = sk->sk_prot->sysctl_mem[index];
|
||||
|
||||
if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
|
||||
prot = sk->sk_cgrp->sysctl_mem;
|
||||
return prot[index];
|
||||
limit = min_t(long, limit, sk->sk_cgrp->memory_allocated.limit);
|
||||
|
||||
return limit;
|
||||
}
|
||||
|
||||
static inline void memcg_memory_allocated_add(struct cg_proto *prot,
|
||||
|
Reference in New Issue
Block a user