]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: receiver: Remove tgroup_mask from struct shard_info
authorOlivier Houchard <ohouchard@haproxy.com>
Wed, 7 Jan 2026 01:36:55 +0000 (02:36 +0100)
committerOlivier Houchard <ohouchard@haproxy.com>
Wed, 7 Jan 2026 08:27:12 +0000 (09:27 +0100)
The only purpose from tgroup_mask seems to be to calculate how many
tgroups share the same shard, but this is an information we can
calculate differently, we just have to increment the number when a new
receiver is added to the shard, and decrement it when one is detached
from the shard. Removing thread group masks will allow us to increase
the maximum number of thread groups past 64.

include/haproxy/receiver-t.h
src/listener.c

index e4e9b292262f2c681b4f3acdd133b92c2a259c40..d1897de5130fc2c0f1feb7e132c56fa55a217198 100644 (file)
@@ -64,7 +64,6 @@ struct rx_settings {
 struct shard_info {
        uint nbgroups;                         /* number of groups in this shard (=#rx); Zero = unused. */
        uint nbthreads;                        /* number of threads in this shard (>=nbgroups) */
-       ulong tgroup_mask;                     /* bitmask of thread groups having a member here */
        struct receiver *ref;                  /* first one, reference for FDs to duplicate */
        struct receiver *members[MAX_TGROUPS]; /* all members of the shard (one per thread group) */
 };
index 0ad6d7c848061702b4a2c30f7baa66d4960f5451..69344d356a6d23c6469f3aa0a3a6fb0a0d9dccb4 100644 (file)
@@ -882,9 +882,7 @@ struct shard_info *shard_info_attach(struct receiver *rx, struct shard_info *si)
        }
 
        rx->shard_info = si;
-       BUG_ON (si->tgroup_mask & 1UL << (rx->bind_tgroup - 1));
-       si->tgroup_mask |= 1UL << (rx->bind_tgroup - 1);
-       si->nbgroups     = my_popcountl(si->tgroup_mask);
+       si->nbgroups++;
        si->nbthreads   += my_popcountl(rx->bind_thread);
        si->members[si->nbgroups - 1] = rx;
        return si;
@@ -913,8 +911,7 @@ void shard_info_detach(struct receiver *rx)
        BUG_ON(gr == MAX_TGROUPS);
 
        si->nbthreads   -= my_popcountl(rx->bind_thread);
-       si->tgroup_mask &= ~(1UL << (rx->bind_tgroup - 1));
-       si->nbgroups     = my_popcountl(si->tgroup_mask);
+       si->nbgroups--;
 
        /* replace the member by the last one. If we removed the reference, we
         * have to switch to another one. It's always the first entry so we can