]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: threads: mark all_threads_mask as read_mostly
authorWilly Tarreau <w@1wt.eu>
Sat, 10 Apr 2021 15:28:18 +0000 (17:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 10 Apr 2021 17:27:41 +0000 (19:27 +0200)
This variable almost never changes and is read a lot in time-critical
sections. threads_want_rdv_mask is read very often as well in
thread_harmless_end() and is almost never changed (only when someone
uses thread_isolate()). Let's move both to read_mostly.

src/thread.c

index 93a529420414695ca5762d5f0ffef1684a0cb4e7..742e47c09d150eed309e8e6b804f54120aed1b92 100644 (file)
@@ -34,10 +34,10 @@ THREAD_LOCAL struct thread_info *ti = &ha_thread_info[0];
 
 #ifdef USE_THREAD
 
-volatile unsigned long threads_want_rdv_mask = 0;
+volatile unsigned long threads_want_rdv_mask __read_mostly = 0;
 volatile unsigned long threads_harmless_mask = 0;
 volatile unsigned long threads_sync_mask = 0;
-volatile unsigned long all_threads_mask  = 1; // nbthread 1 assumed by default
+volatile unsigned long all_threads_mask __read_mostly  = 1; // nbthread 1 assumed by default
 THREAD_LOCAL unsigned int  tid           = 0;
 THREAD_LOCAL unsigned long tid_bit       = (1UL << 0);
 int thread_cpus_enabled_at_boot          = 1;