]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSD: only wake up empty pqueue. 28832/head
authorJianpeng Ma <jianpeng.ma@intel.com>
Tue, 2 Jul 2019 07:24:28 +0000 (15:24 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Wed, 3 Jul 2019 05:41:14 +0000 (13:41 +0800)
Reduce unnecessary wakeups. Especially for heavy load scenarios,
the queue is basically not empty.
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/osd/OSD.cc

index f85d33cead1a958b6e8385e897621c95ef4ab1a0..9d8596d4155a51b423315ff3524a11b18d0a4e8a 100644 (file)
@@ -10520,6 +10520,7 @@ void OSD::ShardedOpWQ::_enqueue(OpQueueItem&& item) {
   sdata->shard_lock.lock();
 
   dout(20) << __func__ << " " << item << dendl;
+  bool empty = sdata->pqueue->empty();
   if (priority >= osd->op_prio_cutoff)
     sdata->pqueue->enqueue_strict(
       item.get_owner(), priority, std::move(item));
@@ -10528,8 +10529,10 @@ void OSD::ShardedOpWQ::_enqueue(OpQueueItem&& item) {
       item.get_owner(), priority, cost, std::move(item));
   sdata->shard_lock.unlock();
 
-  std::lock_guard l{sdata->sdata_wait_lock};
-  sdata->sdata_cond.notify_one();
+  if (empty) {
+    std::lock_guard l{sdata->sdata_wait_lock};
+    sdata->sdata_cond.notify_one();
+  }
 }
 
 void OSD::ShardedOpWQ::_enqueue_front(OpQueueItem&& item)