9231e466cbc5effdf791bf331ed6b07608e8fa80
[openwrt-packages.git] /
1 commit 7607ec0917c33ce511d46b791dfa5550451dd538
2 Author: Willy Tarreau <w@1wt.eu>
3 Date:   Tue Aug 7 10:07:15 2018 +0200
4
5     BUG/MEDIUM: threads: fix the no-thread case after the change to the sync point
6     
7     In commit 0c026f4 ("MINOR: threads: add more consistency between certain
8     variables in no-thread case"), we ensured that we don't have all_threads_mask
9     zeroed anymore. But one test was missed for the write() to the sync pipe.
10     This results in a situation where when running single-threaded, once a
11     server status changes, a wake-up message is written to the pipe and never
12     consumed, showing a 100% CPU usage.
13     
14     No backport is needed.
15     (cherry picked from commit ab657ce2511c4e19b0191fbe1c98cfd823a3c5d6)
16     [wt: the offending patch was just backported as the previous one]
17     Signed-off-by: Willy Tarreau <w@1wt.eu>
18
19 diff --git a/src/hathreads.c b/src/hathreads.c
20 index 238cbb80..ba05fe27 100644
21 --- a/src/hathreads.c
22 +++ b/src/hathreads.c
23 @@ -71,7 +71,7 @@ void thread_sync_enable(void)
24   */
25  void thread_want_sync()
26  {
27 -       if (all_threads_mask) {
28 +       if (all_threads_mask & (all_threads_mask - 1)) {
29                 if (threads_want_sync & tid_bit)
30                         return;
31                 if (HA_ATOMIC_OR(&threads_want_sync, tid_bit) == tid_bit)
git clone https://git.99rst.org/PROJECT