]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stktable: Save 8 bytes in stksess structure
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 14 Oct 2025 16:43:24 +0000 (18:43 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 30 Oct 2025 13:52:02 +0000 (14:52 +0100)
Thanks to the previous change, it is possible to save 8 bytes in the stksess
structure. the <shard> field is now a 16-bits unsigned integer. It is
possible because its max value is tested during parsing. <seen> is now a
8-bits integer because its value is 0 or 1. And <updt_type> is now 8-bits
integer too. It is one of STKSESS_UPDT_ value.

include/haproxy/stick_table-t.h

index ce9a8c205c27f68cd9235cda89c8173f2a6c53a4..efbc9da429309754a2390d32654eb83074d5c5ce 100644 (file)
@@ -157,12 +157,16 @@ struct stksess {
        unsigned int expire;      /* session expiration date */
        unsigned int ref_cnt;     /* reference count, can only purge when zero */
        __decl_thread(HA_RWLOCK_T lock); /* lock related to the table entry */
-       int shard;                /* shard number used by peers */
-       int seen;                 /* 0 only when no peer has seen this entry yet */
+
+       uint16_t shard;     /* shard number used by peers */ // TODO: rename
+       uint8_t seen;       /* 0 only when no peer has seen this entry yet */
+       uint8_t updt_type;  /* One of STKSESS_UPDT_* value */
+
+       /* 4-bytes hole here */
+
        struct eb32_node exp;     /* ebtree node used to hold the session in expiration tree */
        struct list upd;          /* entry in the table's update sequence list */
        struct mt_list pend_updts;/* list of entries to be inserted/moved in the update sequence tree */
-       unsigned int updt_type;   /* One of STKSESS_UPDT_* value */
        struct ebmb_node key;     /* ebtree node used to hold the session in table */
        /* WARNING! do not put anything after <keys>, it's used by the key */
 };