Skip to content

Commit 5c1ebbf

Browse files
Brian VazquezPaolo Abeni
authored andcommitted
net: use indirect calls helpers for sk_exit_memory_pressure()
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: 4890b68 ("net: keep sk->sk_forward_alloc as small as possible") Reported-by: Florian Westphal <[email protected]> Link: https://lore.kernel.org/netdev/[email protected]/T/ Signed-off-by: Brian Vazquez <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 044c8bf commit 5c1ebbf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/core/sock.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2818,7 +2818,8 @@ static void sk_enter_memory_pressure(struct sock *sk)
28182818
static void sk_leave_memory_pressure(struct sock *sk)
28192819
{
28202820
if (sk->sk_prot->leave_memory_pressure) {
2821-
sk->sk_prot->leave_memory_pressure(sk);
2821+
INDIRECT_CALL_INET_1(sk->sk_prot->leave_memory_pressure,
2822+
tcp_leave_memory_pressure, sk);
28222823
} else {
28232824
unsigned long *memory_pressure = sk->sk_prot->memory_pressure;
28242825

0 commit comments

Comments
 (0)