]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
msg/DispatchQueue: wake up only one dispatch thread
authorMax Kellermann <max.kellermann@gmail.com>
Mon, 30 Sep 2024 09:10:16 +0000 (11:10 +0200)
committerMax Kellermann <max.kellermann@ionos.com>
Mon, 7 Oct 2024 20:50:20 +0000 (22:50 +0200)
When adding one message, only one thread needs to be woken up.  Waking
up all is a more expensive operation and leads to unnecessary lock
contention and context switches.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
src/msg/DispatchQueue.cc

index b8ed6f7efe8f6ca1d6a4427834a0f6e4407f85fc..4694bdff587135cc2406f97b411392a8bcb92b7d 100644 (file)
@@ -93,7 +93,7 @@ void DispatchQueue::enqueue(const ref_t<Message>& m, int priority, uint64_t id)
   } else {
     mqueue.enqueue(id, priority, m->get_cost(), QueueItem(m));
   }
-  cond.notify_all();
+  cond.notify_one();
 }
 
 void DispatchQueue::local_delivery(const ref_t<Message>& m, int priority)