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.
This commit is contained in:
Olivier Houchard 2026-01-07 02:36:55 +01:00
parent c3fcdfaf5c
commit 41cd589645
2 changed files with 2 additions and 6 deletions

View 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) */
};

View 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