]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: tinfo: replace the tgid with tgid_bit in tgroup_info
authorWilly Tarreau <w@1wt.eu>
Tue, 28 Jun 2022 15:48:07 +0000 (17:48 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 1 Jul 2022 17:15:14 +0000 (19:15 +0200)
Now that the tgid is accessible from the thread, it's pointless to have
it in the group, and it was only set but never used. However we'll soon
frequently need the mask corresponding to the group ID and the risk of
getting it wrong with the +1 or to shift 1 instead of 1UL is important,
so let's store the tgid_bit there.

include/haproxy/tinfo-t.h
src/thread.c

index bbba5a1dbc644e4613bc4ae241cb10e35fcc4f8c..5f0d7942604a47c79ba6c8613771922217449f86 100644 (file)
@@ -54,7 +54,7 @@ enum {
 struct tgroup_info {
        uint base;                 /* first thread in this group */
        uint count;                /* number of threads in this group */
-       uint tgid;                 /* group ID (starts at 1, 0=unspecified) */
+       ulong tgid_bit;            /* bit corresponding to the tgroup ID */
 
        /* pad to cache line (64B) */
        char __pad[0];            /* unused except to check remaining room */
index c5f06038f317f5d76bc4049ca61b6f77eb9a9c30..dedde13b4c9e2da684fd23eb1750b5fbc9eee565 100644 (file)
@@ -1019,7 +1019,7 @@ int thread_map_to_groups()
        for (g = 0; g < global.nbtgroups; g++) {
                if (!ha_tgroup_info[g].count)
                        ug++;
-               ha_tgroup_info[g].tgid = g + 1;
+               ha_tgroup_info[g].tgid_bit = 1UL << g;
        }
 
        if (ug > ut) {