Re: [PATCH nf v4 0/3] ipvs: fix destination overload state updates

Julian Anastasov <[email protected]> Sun, 2 Aug 2026 14:30:21 +0300 (EEST)
Newsgroups org.kernel.vger.lvs-devel,org.kernel.vger.linux-kernel,org.kernel.vger.netdev,org.kernel.vger.netfilter-devel,org.kernel.vger.stable
Message-ID <[email protected]>
	Hello,

On Fri, 31 Jul 2026, Yizhou Zhao wrote:

> IPVS schedulers read destination overload state while connection accounting
> and destination configuration can update it concurrently.
> 
> The first patch adds a single total connection counter. The second patch
> uses it to identify threshold crossings precisely, and updates OVERLOAD at
> the crossings and on a threshold edit under dst_lock. The third patch moves
> configuration-controlled AVAILABLE to a separate cflags word, so it cannot
> clobber OVERLOAD through an unrelated read-modify-write update.
> 
> Readers can still observe stale destination state. This series does not
> provide a cross-field consistent snapshot.
> 
> Changes in v4:
> - Add the total connection counter and threshold-crossing overload updates.
> - Update OVERLOAD under dst_lock at threshold crossings and destination edits.
> - Keep OVERLOAD in dest->flags; drop the flags2/bitops approach.
> - Move AVAILABLE to the separate cflags word, avoiding RMW interference
>   between availability and overload updates.
> - Link to v3: https://lore.kernel.org/netfilter-devel/[email protected]/
> 
> Julian Anastasov (2):
>   ipvs: add totalconns for dest
>   ipvs: properly update the overload flag on dest edit
> 
> Yizhou Zhao (1):
>   ipvs: separate destination availability state

	The patchset looks good to me, thanks!

	My

Acked-by: Julian Anastasov <[email protected]>

	is needed only for patch 3

	As for the comments from Sashiko:

https://sashiko.dev/#/patchset/20260731142748.56545-1-zhaoyz24%40mails.tsinghua.edu.cn

Patch 1:

- 8-bit shift and overflow: this is exsiting formula that can be
changed separately

- non-atomic update for dest->flags: we fix the write access in patch 3

Patch 2:

- the update of the OVERLOAD flag is serialized in patch 2
and the non-atomic write access fixed in patch 3

Patch 3:

- placing cflags in different cacheline is not our goal,
only separating the flags because while the flags are
alone in their field we do not need bitops for now

>  include/net/ip_vs.h                   | 27 +++++++--
>  include/uapi/linux/ip_vs.h            |  6 --
>  net/netfilter/ipvs/ip_vs_conn.c       | 45 +++++----------
>  net/netfilter/ipvs/ip_vs_core.c       |  6 +-
>  net/netfilter/ipvs/ip_vs_ctl.c        | 81 ++++++++++++++++++++++-----
>  net/netfilter/ipvs/ip_vs_dh.c         |  4 +-
>  net/netfilter/ipvs/ip_vs_lblc.c       |  2 +-
>  net/netfilter/ipvs/ip_vs_lblcr.c      |  8 +--
>  net/netfilter/ipvs/ip_vs_lc.c         |  4 +-
>  net/netfilter/ipvs/ip_vs_proto_sctp.c |  2 -
>  net/netfilter/ipvs/ip_vs_proto_tcp.c  |  2 -
>  net/netfilter/ipvs/ip_vs_sync.c       |  7 +--
>  net/netfilter/ipvs/ip_vs_xmit.c       |  4 +-
>  13 files changed, 118 insertions(+), 80 deletions(-)
> 
> 
> base-commit: 2195424c3da2ef1829a63b807e3a900a90e57d85
> -- 
> 2.34.1

Regards

--
Julian Anastasov <[email protected]>