From: Linkui Xiao <xiaolinkui@126.com>
To: Julian Anastasov <ja@ssi.bg>
Cc: horms@verge.net.au, dsahern@kernel.org, idosch@nvidia.com,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, netdev@vger.kernel.org,
lvs-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
Linkui Xiao <xiaolinkui@kylinos.cn>
Subject: Re: [PATCH net-next] ipvs: annotate the lockless read of sysctl_sync_threshold[0]
Date: Thu, 29 Oct 2026 15:12:24 +0800 [thread overview]
Message-ID: <ede3104a-7e14-40ac-b16c-9750d5b2a8a7@126.com> (raw)
In-Reply-To: <45d598e6-3625-0879-59b0-51f649ebe509@ssi.bg>
Hi Julian, Simon,
Thanks for the reviews.
On Wed, Oct 28, 2026 at 07:15:34PM +0300, Julian Anastasov wrote:
> Yes, ACCESS_ONCE was used to solve possible division-by-zero problem,
> not to solve the data race. Even if memcpy is converted to 2 int copies
> on some archs (eg. x86) may be it is time to use 2 WRITE_ONCE instead of
> the last memcpy. Can you include this change in v2. Post it when net-next
> opens again by using nf-next tag.
Agreed. v2 replaces the last memcpy() in proc_do_sync_threshold() with
two WRITE_ONCE() stores, one per element. The if/else branches gained
braces to keep checkpatch --strict happy about the now multi-statement
else.
net-next is currently closed and is scheduled to reopen on November 9th
(https://netdev.bots.linux.dev/net-next.html). I will post it as
[PATCH nf-next v2] then.
On Tue, Oct 28, 2026 at 12:49:35PM +0000, Simon Horman wrote:
> I wonder if it would also be appropriate to call
> sysctl_sync_threshold() only once (per-packet) in
> ip_vs_sync_conn_needed(). Stashing the value in a local variable if
> appropriate.
Agreed, and thank you. v2 reads the value once into a local variable,
sync_threshold, before the branch and uses it in either branch.
One precision while re-checking the code: the two call sites are on
mutually exclusive branches of the same if/else, so a single packet
never reads the value twice at runtime. My v1 commit message overstated
this ("the two comparisons ... can observe different values for one and
the same packet"); v2 rewords that paragraph and notes the rewording in
Changes in v2. Stashing a single snapshot is still the cleaner shape, so
the change is worthwhile regardless.
Thanks,
Linkui Xiao
next prev parent reply other threads:[~2026-10-29 7:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 8:37 Linkui Xiao
2026-10-28 12:49 ` Simon Horman
2026-10-28 19:15 ` Julian Anastasov
2026-10-29 7:12 ` Linkui Xiao [this message]
2026-10-29 11:55 ` Julian Anastasov
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=ede3104a-7e14-40ac-b16c-9750d5b2a8a7@126.com \
--to=xiaolinkui@126.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@verge.net.au \
--cc=idosch@nvidia.com \
--cc=ja@ssi.bg \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lvs-devel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=xiaolinkui@kylinos.cn \
/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
all inboxes | Powered by JetHome®