]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: stick-table: slightly reorder the stktable struct
authorWilly Tarreau <w@1wt.eu>
Mon, 7 Aug 2023 19:32:36 +0000 (21:32 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 11 Aug 2023 17:03:35 +0000 (19:03 +0200)
By moving the config-time stuff after the updt_lock, we can plug some
holes without interfering with it. This allows us to get back to the
768-bytes struct. The performance was not affected at all.

include/haproxy/stick_table-t.h

index d022de009e2912bc06a206546e8d9cc013c7e0eb..c89c3ec8e717caf9eb24205c455016b1f54ca597 100644 (file)
@@ -187,11 +187,6 @@ struct stktable {
                void *p;
        } data_arg[STKTABLE_DATA_TYPES]; /* optional argument of each data type */
        struct proxy *proxy;      /* The proxy this stick-table is attached to, if any.*/
-       struct proxy *proxies_list; /* The list of proxies which reference this stick-table. */
-       struct {
-               const char *file;     /* The file where the stick-table is declared. */
-               int line;             /* The line in this <file> the stick-table is declared. */
-       } conf;
 
        THREAD_ALIGN(64);
 
@@ -210,8 +205,15 @@ struct stktable {
        unsigned int commitupdate;/* used to identify the latest local updates pending for sync, uses updt_lock */
 
        THREAD_ALIGN(64);
-
+       /* this lock is heavily used and must be on its own cache line */
        __decl_thread(HA_RWLOCK_T updt_lock); /* lock protecting the updates part */
+
+       /* rarely used config stuff below (should not interfere with updt_lock) */
+       struct proxy *proxies_list; /* The list of proxies which reference this stick-table. */
+       struct {
+               const char *file;     /* The file where the stick-table is declared. */
+               int line;             /* The line in this <file> the stick-table is declared. */
+       } conf;
 };
 
 extern struct stktable_data_type stktable_data_types[STKTABLE_DATA_TYPES];