From: Jianpeng Ma Date: Tue, 12 Sep 2017 21:05:21 +0000 (+0800) Subject: osd/OSD: Using Wait rather than WaitInterval to wait queue.is_empty(). X-Git-Tag: v13.0.1~261^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fb6eca1fb25c90ceb16ca5400355f81b0498c285;p=ceph.git osd/OSD: Using Wait rather than WaitInterval to wait queue.is_empty(). Why use WaitInterval, there is a comment:"optimistically sleep a moment; maybe another work item will come along." But in fact,we don't see any benefit for this optimization. Signed-off-by: Jianpeng Ma --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 7518ac79732..43c13f1e074 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -9755,19 +9755,18 @@ void OSD::ShardedOpWQ::_process(uint32_t thread_index, heartbeat_handle_d *hb) sdata->sdata_op_ordering_lock.Lock(); if (sdata->pqueue->empty()) { dout(20) << __func__ << " empty q, waiting" << dendl; - // optimistically sleep a moment; maybe another work item will come along. - osd->cct->get_heartbeat_map()->reset_timeout(hb, - osd->cct->_conf->threadpool_default_timeout, 0); + osd->cct->get_heartbeat_map()->clear_timeout(hb); sdata->sdata_lock.Lock(); sdata->sdata_op_ordering_lock.Unlock(); - sdata->sdata_cond.WaitInterval(sdata->sdata_lock, - utime_t(osd->cct->_conf->threadpool_empty_queue_max_wait, 0)); + sdata->sdata_cond.Wait(sdata->sdata_lock); sdata->sdata_lock.Unlock(); sdata->sdata_op_ordering_lock.Lock(); if (sdata->pqueue->empty()) { sdata->sdata_op_ordering_lock.Unlock(); return; } + osd->cct->get_heartbeat_map()->reset_timeout(hb, + osd->cct->_conf->threadpool_default_timeout, 0); } OpQueueItem item = sdata->pqueue->dequeue(); if (osd->is_stopping()) {