diff options
author | 2021-12-17 11:56:59 -0600 | |
---|---|---|
committer | 2021-12-17 12:56:59 -0500 | |
commit | 0b418d65bae66baa9f334c6daa6dcb4148909f7f (patch) | |
tree | 5684845e290fd284766adced617cb74df8ba619d /src/osd/osdsync.h | |
parent | d18b50423622eaf8c0304d3d20c1a6b189b9a8d9 (diff) |
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
Diffstat (limited to 'src/osd/osdsync.h')
-rw-r--r-- | src/osd/osdsync.h | 12 |
1 files changed, 7 insertions, 5 deletions
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<int32_t> m_autoreset; - std::atomic<int32_t> m_signalled; + int32_t m_autoreset; + int32_t m_signalled; }; |