History

ipvs: separate destination availability state

IPVS configuration paths update destination availability while connection accounting updates destination overload state. The two independent states share dest->flags, so their read-modify-write updates can race and lose one another. Keep OVERLOAD in flags, where the preceding patch serializes its updates with dst_lock, and move AVAILABLE to cflags. This keeps configuration- controlled availability out of the scheduler hot cacheline until a scheduler needs to check it. It also prevents availability updates from clobbering overload state. The destination status bits are not exposed through the IPVS sockopt or netlink interfaces, so keep their definitions in the internal IPVS header. Readers can still observe stale destination state; this does not provide a cross-field snapshot.

Yizhou Zhao committed 3 months ago

Commit cdcc4e41 parent 8f843449 files · +23 −22Browse files

Showing the changes to include (2 of 9 files). Show all

Unified · Split

2 files
  1. include/net/ip_vs.h +7 −0
  2. include/uapi/linux/ip_vs.h +0 −6
include/net/ip_vs.h+7−0
@@ -36,6 +36,12 @@ · 35 unmodified lines
36#define IP_VS_HDR_INVERSE 136#define IP_VS_HDR_INVERSE 1
37#define IP_VS_HDR_ICMP 237#define IP_VS_HDR_ICMP 2
38 38
39/* Destination Server Flags */
40#define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */
41
42/* Destination Server Config Flags */
43#define IP_VS_DEST_CF_AVAILABLE 0x0001 /* server is available */
44
39/* conn_tab limits (as per Kconfig) */45/* conn_tab limits (as per Kconfig) */
40#define IP_VS_CONN_TAB_MIN_BITS 846#define IP_VS_CONN_TAB_MIN_BITS 8
41#if BITS_PER_LONG > 3247#if BITS_PER_LONG > 32
@@ -976,6 +982,7 @@ struct ip_vs_dest { · 934 unmodified lines
976 volatile unsigned int flags; /* dest status flags */982 volatile unsigned int flags; /* dest status flags */
977 atomic_t conn_flags; /* flags to copy to conn */983 atomic_t conn_flags; /* flags to copy to conn */
978 atomic_t weight; /* server weight */984 atomic_t weight; /* server weight */
985 unsigned long cflags; /* config flags */
979 atomic_t last_weight; /* server latest weight */986 atomic_t last_weight; /* server latest weight */
980 __u16 tun_type; /* tunnel type */987 __u16 tun_type; /* tunnel type */
981 __be16 tun_port; /* tunnel port */988 __be16 tun_port; /* tunnel port */
include/uapi/linux/ip_vs.h+0−6
@@ -28,12 +28,6 @@ · 27 unmodified lines
28#define IP_VS_SVC_F_SCHED_SH_FALLBACK IP_VS_SVC_F_SCHED1 /* SH fallback */28#define IP_VS_SVC_F_SCHED_SH_FALLBACK IP_VS_SVC_F_SCHED1 /* SH fallback */
29#define IP_VS_SVC_F_SCHED_SH_PORT IP_VS_SVC_F_SCHED2 /* SH use port */29#define IP_VS_SVC_F_SCHED_SH_PORT IP_VS_SVC_F_SCHED2 /* SH use port */
30 30
31/*
32 * Destination Server Flags
33 */
34#define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */
35#define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */
36
37/*31/*
38 * IPVS sync daemon states32 * IPVS sync daemon states
39 */33 */