From 41cd5896456383b24c50620e7da0af92baa58638 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Wed, 7 Jan 2026 02:36:55 +0100 Subject: [PATCH] MINOR: receiver: Remove tgroup_mask from struct shard_info 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 | 1 - src/listener.c | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/include/haproxy/receiver-t.h b/include/haproxy/receiver-t.h index e4e9b2922..d1897de51 100644 --- a/include/haproxy/receiver-t.h +++ b/include/haproxy/receiver-t.h @@ -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) */ }; diff --git a/src/listener.c b/src/listener.c index 0ad6d7c84..69344d356 100644 --- a/src/listener.c +++ b/src/listener.c @@ -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