Article View: linux.kernel.netdev
Article #8479Re: [PATCH net-next] ipvs: annotate the lockless read of sysctl_sync_threshold[0]
From: Linkui Xiao
Date: Thu, 29 Oct 2026 07:12
Date: Thu, 29 Oct 2026 07:12
40 lines
10251 bytes
10251 bytes
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
Technical Details
Message-ID:
<ede3104a-7e14-40ac-b16c-9750d5b2a8a7@126.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353185-linux-kernel-netdev=dewy.ruReferences:
<20261026083708.617278-1-xiaolinkui@126.com> <45d598e6-3625-0879-59b0-51f649ebe509@ssi.bg>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353185-linux-kernel-netdev=dewy.ru From: xiaolinkui@126.com (Linkui Xiao) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next] ipvs: annotate the lockless read of sysctl_sync_threshold[0] Date: Thu, 29 Oct 2026 15:12:24 +0800 Organization: Usenet Network Message-ID: <ede3104a-7e14-40ac-b16c-9750d5b2a8a7@126.com> References: <20261026083708.617278-1-xiaolinkui@126.com> <45d598e6-3625-0879-59b0-51f649ebe509@ssi.bg> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="1955331"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:aLEVWJzCSpHTb9+rzkGGNa6LGK4= sha256:1Zr+oIuknGGVDpZ8DF3QkgNnmJXZopENlz9DK5rhl2A= sha1:RIVqzPivqShXhW1MfkYOLJGAzCM= sha256:Tspe7maszxy7beNP9LUjHE3Iyi4H9/S5UhqyxBBoUxQ= Content-Language: en-US List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 47BF8125C59; Thu, 29 Oct 2026 10:14:50 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.047 X-Spam-Status: No, score=-3.047 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=126.com X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X-2QJ_MbtZJ9; Thu, 29 Oct 2026 10:14:46 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-353185-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=126.com X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 89632125C44; Thu, 29 Oct 2026 10:14:36 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id F26DA28E88; Thu, 29 Oct 2026 07:14:08 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793258047; b=2pMv32cNOUzB4YEhP0kG8fTI4AbpnuBdNLVw9ZTLgCWQJyUmqrgCgv6rWLCNzRP8f0pu DZdoa7fUq2EH1ubaBvfF9tSxlmZ6ahL/QJrhhOf6BpEdSJeJBFF8AVVXd36AVjU5ggL4I 5MGndEMp/DznG7y3jVE6dFeMJQxRb3lhw/H0ndVulgnzU89fb569FOpCuctZzZzb+hD2D /tS72MO99fjQSOF6XvOC+xdjm1jFluGiHHqtBXgmnGODskmeC3P2mEJ0jTMd9EuwjUNF4 PIlUJLLR0lFaHzWpFwrvsGw953KAW0hr0BMZb6u93EOTsETCThPeb1i9ijpyoyeVflg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793258047; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Message-ID:Date: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-CM-TRANSID: X-Coremail-Antispam:X-CM-SenderInfo; bh=RbnMv4NDWsSfm6NxZli87tg/xVFmW0yI0I8tPFPNz/g=; b=ZY69aVKixJtGhi4WOhFiTd0vWxrsFAF3m8vC4rGdNqSS113f0JTHoF4NmD7PbhNwHSG/ 2o+IVT0tUQiRxcf9zJo0CCIw1o3EYIBUhAOOSItQF0wT9GlsMtSHTzU6QhF/HEmtUvAfL ALEEu+R2iThV+1pu4k/tbzYX2rgk8u030zycrz/EvJEJAuLiKGHVDxLlCa5elstSn5scm md1T/xaDBU8wvGr8yA5E0ys2n9YwVMcPJoWfjXIflUfY7wgruN2fov8S/L0wIgOl526/G 0kFsa7IgBbp6wk/K9DWYEwfojFi/eJPJw6ls60GI7h5BRh8blIYE5i4IQGnX+CegnRg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=n1ugxA1Y; dmarc=pass header.from=126.com; spf=pass smtp.mailfrom=126.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5071F606A324; Thu, 29 Oct 2026 07:14:07 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=n1ugxA1Y X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=117.135.210.8 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793258046; b=nFsA5ltz/ujF5K33JXZbep8odIK3G0oSpbnrvogmOrxJA407K5uAR5Z1Apa6EBJ07gax aDcF61E0Rl10+a1UHAMQtbUmVyCKrFmhhJThGI2mZCODncwYxD0tW8ETHtsJa14o3gqzV lI4ciL9UOZPmD+SEz/2/QLXGMFEdG8GRaLLR2DMz5fUBKEZ6jsA01ngVz9FXMK1jvbpFX B2ZyenoA323vooeBn9rve+5fG0xFKbTqAyhbTwdkUMAjk5xGAEE5RwqGG5PxiOQMtuAMh QxjOMJmIWNcGInsiwR/R/hN9P5VG+40NfF7VxOazsedfKRM7aTCz0LSLk6hX1sU4QwA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793258046; h=DMARC-Filter:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-CM-TRANSID: X-Coremail-Antispam:X-CM-SenderInfo; bh=RbnMv4NDWsSfm6NxZli87tg/xVFmW0yI0I8tPFPNz/g=; b=YcuWo4ZX1UlAdrenJp97+8sjz8FF68vfCYoJHBm94WbAVd+AAzArdzEmQ7Gn5ZjNbia4 PfdZd5Ty87FOwTkqxppyZi5hh472mApf4PwYwJ7Q505etdYTQpl6nbKiNxkjFcsDFAFWR XbS7o6ls7vF3srW9nr+kWuM5JTVxhSFMPbCxQ/jcYJqmFFKib/DN6bLSc1NDQhAFF28rb B7uJy7N7S2n3Q/U6Yjeli+RgqNuk6YcsRNQKIne/ZwW0OZ1eEw7W2GqzSqIb3odMqxGjx l4r7cSjspwJVwzbkuANW5pKM5/DD4dsYY6VUrHYJXtj3jHQv6M8XsbTph+UP84WH2Tg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=126.com; spf=pass smtp.mailfrom=126.com; dkim=pass header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=n1ugxA1Y; arc=none smtp.remote-ip=117.135.210.8 X-Received: from m16.mail.126.com (m16.mail.126.com [117.135.210.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74C9A606A31A; Thu, 29 Oct 2026 07:14:03 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 74C9A606A31A X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=126.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=126.com X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=Message-ID:Date:MIME-Version:Subject:To:From: Content-Type; bh=RbnMv4NDWsSfm6NxZli87tg/xVFmW0yI0I8tPFPNz/g=; b=n1ugxA1Y4FY/D66ZAf6vU6Da+o8xXcBIJ/SYYtkXRqDK9dQU8zKVH5SdC5rCOP GZhonQzO9F+jboy+PzqS+s0aFtbOPy4vAh8KbVzqnHK0Lr3Paxd14rE8oIbnAXDR oF1NpCctM8/muSuNfE0jYdyhL7CHRa24gYL8xZMdCkD/0= X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-User-Agent: Mozilla Thunderbird X-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> X-In-Reply-To: <45d598e6-3625-0879-59b0-51f649ebe509@ssi.bg> X-CM-TRANSID: _____wD339LY8eJqcEnFBw--.42381S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7KFyrXr43JFWDKr1xXr43Jrb_yoW8Ar1kpa 9FkF4qyrWkJw4fZFZ7Cw47ZFZaqws7A3s0kwn8ArWDAa13Xrn2yrWSyay5GFyqkFn3u3ZY vayUX3s5Aw4kZaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UZZ2-UUUUU= X-CM-SenderInfo: p0ld0z5lqn3xa6rslhhfrp/xtbBlRsG3Gri8dvnSQAA3Y