From: Max Kellermann Date: Mon, 7 Oct 2024 19:22:10 +0000 (+0200) Subject: common/Finisher: call notify_one() instead of notify_all() X-Git-Tag: v20.0.0~789^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=09df46644e083d53e161416dfbd0f9050e0f1b77;p=ceph.git common/Finisher: call notify_one() instead of notify_all() As noted in commit cc7ec3e18d1, there is only ever a single `Finisher` thread, therefore the overhead for `notify_all()` can be eliminated. Signed-off-by: Max Kellermann --- diff --git a/src/common/Finisher.cc b/src/common/Finisher.cc index 20b8829d7ec..8f2262235e8 100644 --- a/src/common/Finisher.cc +++ b/src/common/Finisher.cc @@ -20,7 +20,7 @@ void Finisher::stop() finisher_stop = true; // we don't have any new work to do, but we want the worker to wake up anyway // to process the stop condition. - finisher_cond.notify_all(); + finisher_cond.notify_one(); finisher_lock.unlock(); finisher_thread.join(); // wait until the worker exits completely ldout(cct, 10) << __func__ << " finish" << dendl; diff --git a/src/common/Finisher.h b/src/common/Finisher.h index 732ed746d56..6618749b598 100644 --- a/src/common/Finisher.h +++ b/src/common/Finisher.h @@ -88,7 +88,7 @@ class Finisher { finisher_queue.push_back(std::make_pair(i, 0)); } if (should_notify) { - finisher_cond.notify_all(); + finisher_cond.notify_one(); } } if (logger)