lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230228163453.GA11370@breakpoint.cc>
Date:   Tue, 28 Feb 2023 17:34:53 +0100
From:   Florian Westphal <fw@...len.de>
To:     Alexander Lobakin <aleksander.lobakin@...el.com>
Cc:     Jakub Kicinski <kuba@...nel.org>, Florian Westphal <fw@...len.de>,
        edumazet@...gle.com, netdev@...r.kernel.org, davem@...emloft.net,
        pabeni@...hat.com, shakeelb@...gle.com, soheil@...gle.com
Subject: Re: [PATCH net] net: avoid indirect memory pressure calls

Alexander Lobakin <aleksander.lobakin@...el.com> wrote:
> From: Jakub Kicinski <kuba@...nel.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@...len.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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ