Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: igmp: Avoid zero delay when receiving odd mixture of IGMP queries netdev: make net_device_ops const bcm63xx: make ethtool_ops const usbnet: make ethtool_ops const net: Fix build with INET disabled. net: introduce netif_addr_lock_nested() and call if when appropriate net: correct lock name in dev_[uc/mc]_sync documentations. net: sk_update_clone is only used in net/core/sock.c 8139cp: fix missing napi_gro_flush. pktgen: set correct max and min in pktgen_setup_inject() smsc911x: Unconditionally include linux/smscphy.h in smsc911x.h asix: fix infinite loop in rx_fixup() net: Default UDP and UNIX diag to 'n'. r6040: fix typo in use of MCR0 register bits net: fix sock_clone reference mismatch with tcp memcontrol
This commit is contained in:
@@ -381,16 +381,25 @@ static void mem_cgroup_put(struct mem_cgroup *memcg);
|
||||
static bool mem_cgroup_is_root(struct mem_cgroup *memcg);
|
||||
void sock_update_memcg(struct sock *sk)
|
||||
{
|
||||
/* A socket spends its whole life in the same cgroup */
|
||||
if (sk->sk_cgrp) {
|
||||
WARN_ON(1);
|
||||
return;
|
||||
}
|
||||
if (static_branch(&memcg_socket_limit_enabled)) {
|
||||
struct mem_cgroup *memcg;
|
||||
|
||||
BUG_ON(!sk->sk_prot->proto_cgroup);
|
||||
|
||||
/* Socket cloning can throw us here with sk_cgrp already
|
||||
* filled. It won't however, necessarily happen from
|
||||
* process context. So the test for root memcg given
|
||||
* the current task's memcg won't help us in this case.
|
||||
*
|
||||
* Respecting the original socket's memcg is a better
|
||||
* decision in this case.
|
||||
*/
|
||||
if (sk->sk_cgrp) {
|
||||
BUG_ON(mem_cgroup_is_root(sk->sk_cgrp->memcg));
|
||||
mem_cgroup_get(sk->sk_cgrp->memcg);
|
||||
return;
|
||||
}
|
||||
|
||||
rcu_read_lock();
|
||||
memcg = mem_cgroup_from_task(current);
|
||||
if (!mem_cgroup_is_root(memcg)) {
|
||||
|
Reference in New Issue
Block a user