From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965384AbbLHPhD (ORCPT ); Tue, 8 Dec 2015 10:37:03 -0500 Received: from gum.cmpxchg.org ([85.214.110.215]:48284 "EHLO gum.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964919AbbLHPa4 (ORCPT ); Tue, 8 Dec 2015 10:30:56 -0500 From: Johannes Weiner To: Andrew Morton Cc: linux-mm@kvack.org, netdev@vger.kernel.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/14] net: tcp_memcontrol: remove bogus hierarchy pressure propagation Date: Tue, 8 Dec 2015 10:30:13 -0500 Message-Id: <1449588624-9220-4-git-send-email-hannes@cmpxchg.org> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1449588624-9220-1-git-send-email-hannes@cmpxchg.org> References: <1449588624-9220-1-git-send-email-hannes@cmpxchg.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a cgroup currently breaches its socket memory limit, it enters memory pressure mode for itself and its *ancestors*. This throttles transmission in unrelated sibling and cousin subtrees that have nothing to do with the breached limit. On the contrary, breaching a limit should make that group and its *children* enter memory pressure mode. But this happens already, albeit lazily: if an ancestor limit is breached, siblings will enter memory pressure on their own once the next packet arrives for them. So no additional hierarchy code is needed. Remove the bogus stuff. Signed-off-by: Johannes Weiner Acked-by: David S. Miller Reviewed-by: Vladimir Davydov --- include/net/sock.h | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index 8133c71..e27a8bb 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1152,14 +1152,8 @@ static inline void sk_leave_memory_pressure(struct sock *sk) if (*memory_pressure) *memory_pressure = 0; - if (mem_cgroup_sockets_enabled && sk->sk_cgrp) { - struct cg_proto *cg_proto = sk->sk_cgrp; - struct proto *prot = sk->sk_prot; - - for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) - cg_proto->memory_pressure = 0; - } - + if (mem_cgroup_sockets_enabled && sk->sk_cgrp) + sk->sk_cgrp->memory_pressure = 0; } static inline void sk_enter_memory_pressure(struct sock *sk) @@ -1167,13 +1161,8 @@ static inline void sk_enter_memory_pressure(struct sock *sk) if (!sk->sk_prot->enter_memory_pressure) return; - if (mem_cgroup_sockets_enabled && sk->sk_cgrp) { - struct cg_proto *cg_proto = sk->sk_cgrp; - struct proto *prot = sk->sk_prot; - - for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) - cg_proto->memory_pressure = 1; - } + if (mem_cgroup_sockets_enabled && sk->sk_cgrp) + sk->sk_cgrp->memory_pressure = 1; sk->sk_prot->enter_memory_pressure(sk); } -- 2.6.3 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johannes Weiner Subject: [PATCH 03/14] net: tcp_memcontrol: remove bogus hierarchy pressure propagation Date: Tue, 8 Dec 2015 10:30:13 -0500 Message-ID: <1449588624-9220-4-git-send-email-hannes@cmpxchg.org> References: <1449588624-9220-1-git-send-email-hannes@cmpxchg.org> Cc: linux-mm@kvack.org, netdev@vger.kernel.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org To: Andrew Morton Return-path: In-Reply-To: <1449588624-9220-1-git-send-email-hannes@cmpxchg.org> Sender: owner-linux-mm@kvack.org List-Id: netdev.vger.kernel.org When a cgroup currently breaches its socket memory limit, it enters memory pressure mode for itself and its *ancestors*. This throttles transmission in unrelated sibling and cousin subtrees that have nothing to do with the breached limit. On the contrary, breaching a limit should make that group and its *children* enter memory pressure mode. But this happens already, albeit lazily: if an ancestor limit is breached, siblings will enter memory pressure on their own once the next packet arrives for them. So no additional hierarchy code is needed. Remove the bogus stuff. Signed-off-by: Johannes Weiner Acked-by: David S. Miller Reviewed-by: Vladimir Davydov --- include/net/sock.h | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index 8133c71..e27a8bb 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1152,14 +1152,8 @@ static inline void sk_leave_memory_pressure(struct sock *sk) if (*memory_pressure) *memory_pressure = 0; - if (mem_cgroup_sockets_enabled && sk->sk_cgrp) { - struct cg_proto *cg_proto = sk->sk_cgrp; - struct proto *prot = sk->sk_prot; - - for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) - cg_proto->memory_pressure = 0; - } - + if (mem_cgroup_sockets_enabled && sk->sk_cgrp) + sk->sk_cgrp->memory_pressure = 0; } static inline void sk_enter_memory_pressure(struct sock *sk) @@ -1167,13 +1161,8 @@ static inline void sk_enter_memory_pressure(struct sock *sk) if (!sk->sk_prot->enter_memory_pressure) return; - if (mem_cgroup_sockets_enabled && sk->sk_cgrp) { - struct cg_proto *cg_proto = sk->sk_cgrp; - struct proto *prot = sk->sk_prot; - - for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) - cg_proto->memory_pressure = 1; - } + if (mem_cgroup_sockets_enabled && sk->sk_cgrp) + sk->sk_cgrp->memory_pressure = 1; sk->sk_prot->enter_memory_pressure(sk); } -- 2.6.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org