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
3636 #define IP_VS_HDR_INVERSE 1
3737 #define IP_VS_HDR_ICMP 2
3838
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+
3945 /* conn_tab limits (as per Kconfig) */
4046 #define IP_VS_CONN_TAB_MIN_BITS 8
4147 #if BITS_PER_LONG > 32
@@ -976,6 +982,7 @@ struct ip_vs_dest { · 934 unmodified lines
976982 volatile unsigned int flags; /* dest status flags */
977983 atomic_t conn_flags; /* flags to copy to conn */
978984 atomic_t weight; /* server weight */
985+ unsigned long cflags; /* config flags */
979986 atomic_t last_weight; /* server latest weight */
980987 __u16 tun_type; /* tunnel type */
981988 __be16 tun_port; /* tunnel port */
include/uapi/linux/ip_vs.h+0−6
@@ -28,12 +28,6 @@ · 27 unmodified lines
2828 #define IP_VS_SVC_F_SCHED_SH_FALLBACK IP_VS_SVC_F_SCHED1 /* SH fallback */
2929 #define IP_VS_SVC_F_SCHED_SH_PORT IP_VS_SVC_F_SCHED2 /* SH use port */
3030
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−
3731 /*
3832 * IPVS sync daemon states
3933 */