You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.2 KiB

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