Thread (9 messages) 9 messages, 4 authors, 2023-03-01

Re: [PATCH net] net: avoid indirect memory pressure calls

From: Florian Westphal <fw@strlen.de>
Date: 2023-02-28 16:35:09

Alexander Lobakin [off-list ref] wrote:
From: Jakub Kicinski <kuba@kernel.org>
Date: Mon, 27 Feb 2023 15:27:41 -0800
quoted
On Fri, 24 Feb 2023 19:46:06 +0100 Florian Westphal wrote:
quoted
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.

Fixes: 4890b686f408 ("net: keep sk->sk_forward_alloc as small as possible")
Signed-off-by: Florian Westphal <fw@strlen.de>
Looks acceptable, Eric?
I'm no Eric, but I'd only change this:

+	if (!memory_pressure || READ_ONCE(*memory_pressure) == 0)

to

+	if (!memory_pressure || !READ_ONCE(*memory_pressure))
I intentioanlly used '== 0', i found it too easy to miss the '!' before
'R'.  But maybe I just need better glasses.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help