netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Alexander Lobakin <aleksander.lobakin@intel.com>
Cc: Jakub Kicinski <kuba@kernel.org>, Florian Westphal <fw@strlen.de>,
	edumazet@google.com, netdev@vger.kernel.org, davem@davemloft.net,
	pabeni@redhat.com, shakeelb@google.com, soheil@google.com
Subject: Re: [PATCH net] net: avoid indirect memory pressure calls
Date: Tue, 28 Feb 2023 17:34:53 +0100	[thread overview]
Message-ID: <20230228163453.GA11370@breakpoint.cc> (raw)
In-Reply-To: <0650079e-2cc1-626b-ac04-2230b41fd842@intel.com>

Alexander Lobakin <aleksander.lobakin@intel.com> wrote:
> From: Jakub Kicinski <kuba@kernel.org>
> Date: Mon, 27 Feb 2023 15:27:41 -0800
> 
> > On Fri, 24 Feb 2023 19:46:06 +0100 Florian Westphal wrote:
> >> 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.

  reply	other threads:[~2023-02-28 16:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 18:46 [PATCH net] net: avoid indirect memory pressure calls Florian Westphal
2023-02-27 23:27 ` Jakub Kicinski
2023-02-28 16:28   ` Alexander Lobakin
2023-02-28 16:34     ` Florian Westphal [this message]
2023-02-28 16:35       ` Eric Dumazet
2023-02-28 16:44 ` Eric Dumazet
2023-02-28 17:42   ` Eric Dumazet
2023-03-01 12:31     ` Florian Westphal
2023-03-01 12:51       ` Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230228163453.GA11370@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=aleksander.lobakin@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shakeelb@google.com \
    --cc=soheil@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).