From 0b418d65bae66baa9f334c6daa6dcb4148909f7f Mon Sep 17 00:00:00 2001 From: tellowkrinkle Date: Fri, 17 Dec 2021 11:56:59 -0600 Subject: Fix chdman threading on cpus with many cores (#9006) * osd: Remove 4-thread limit from non-high-freq work queues * osd: osd_event flags don't need to be atomic * osd: Fix race condition that made work queues not wake up enough threads for processing --- src/osd/osdsync.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/osd/osdsync.h') diff --git a/src/osd/osdsync.h b/src/osd/osdsync.h index 3a286b60afa..cd8a6604c21 100644 --- a/src/osd/osdsync.h +++ b/src/osd/osdsync.h @@ -136,16 +136,17 @@ public: Return value: - None + Whether or not the event was actually signalled (false if the event had already been signalled) Notes: All threads waiting for the event will be signalled. -----------------------------------------------------------------------------*/ - void set() + bool set() { m_mutex.lock(); - if (m_signalled == false) + bool needs_signal = !m_signalled; + if (needs_signal) { m_signalled = true; if (m_autoreset) @@ -154,13 +155,14 @@ public: m_cond.notify_all(); } m_mutex.unlock(); + return needs_signal; } private: std::mutex m_mutex; std::condition_variable m_cond; - std::atomic m_autoreset; - std::atomic m_signalled; + int32_t m_autoreset; + int32_t m_signalled; }; -- cgit v1.2.3-70-g09d2