summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorBrian Vazquez <brianvv@google.com>2023-03-01 13:32:47 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-17 08:50:24 +0100
commite8d7615d8f6f0c53082af2c873ace42f819b5863 (patch)
treee9a74a4e77572b02df61ec0ba4be0fd0cc020a7f /net/core
parent14c17c673e1bba08032d245d5fb025d1cbfee123 (diff)
downloadlinux-stable-e8d7615d8f6f0c53082af2c873ace42f819b5863.tar.gz
linux-stable-e8d7615d8f6f0c53082af2c873ace42f819b5863.tar.bz2
linux-stable-e8d7615d8f6f0c53082af2c873ace42f819b5863.zip
net: use indirect calls helpers for sk_exit_memory_pressure()
[ Upstream commit 5c1ebbfabcd61142a4551bfc0e51840f9bdae7af ] Florian reported a regression and sent a patch with the following changelog: <quote> There is a noticeable tcp performance regression (loopback or cross-netns), seen with iperf3 -Z (sendfile mode) when generic retpolines are needed. With SK_RECLAIM_THRESHOLD checks gone number of calls to enter/leave memory pressure happen much more often. For TCP indirect calls are used. We can't remove the if-set-return short-circuit check in tcp_enter_memory_pressure because there are callers other than sk_enter_memory_pressure. Doing a check in the sk wrapper too reduces the indirect calls enough to recover some performance. Before, 0.00-60.00 sec 322 GBytes 46.1 Gbits/sec receiver After: 0.00-60.04 sec 359 GBytes 51.4 Gbits/sec receiver "iperf3 -c $peer -t 60 -Z -f g", connected via veth in another netns. </quote> It seems we forgot to upstream this indirect call mitigation we had for years, lets do this instead. [edumazet] - It seems we forgot to upstream this indirect call mitigation we had for years, let's do this instead. - Changed to INDIRECT_CALL_INET_1() to avoid bots reports. Fixes: 4890b686f408 ("net: keep sk->sk_forward_alloc as small as possible") Reported-by: Florian Westphal <fw@strlen.de> Link: https://lore.kernel.org/netdev/20230227152741.4a53634b@kernel.org/T/ Signed-off-by: Brian Vazquez <brianvv@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Link: https://lore.kernel.org/r/20230301133247.2346111-1-edumazet@google.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/sock.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 4dfdcdfd0011..eb0b76acd9df 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2805,7 +2805,8 @@ static void sk_enter_memory_pressure(struct sock *sk)
static void sk_leave_memory_pressure(struct sock *sk)
{
if (sk->sk_prot->leave_memory_pressure) {
- sk->sk_prot->leave_memory_pressure(sk);
+ INDIRECT_CALL_INET_1(sk->sk_prot->leave_memory_pressure,
+ tcp_leave_memory_pressure, sk);
} else {
unsigned long *memory_pressure = sk->sk_prot->memory_pressure;