]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ShardedThreadPool: make wait timeout on empty queue configurable 4050/head
authorSamuel Just <sjust@redhat.com>
Tue, 10 Feb 2015 01:41:19 +0000 (17:41 -0800)
committerLoic Dachary <ldachary@redhat.com>
Wed, 18 Mar 2015 20:12:51 +0000 (21:12 +0100)
Fixes: 10818
Backport: giant
Signed-off-by: Samuel Just <sjust@redhat.com>
(cherry picked from commit 7002f934e6664daa995ca0629c0ea3bae1c6bddf)

src/common/WorkQueue.cc

index 9d38f08e5388c24dcafe79088195c9ddbe84ecf9..00666faca334365726847a8f2899a09de68c94a6 100644 (file)
@@ -306,8 +306,12 @@ void ShardedThreadPool::shardedthreadpool_worker(uint32_t thread_index)
       ++num_paused;
       wait_cond.Signal();
       while(pause_threads.read()) {
-       cct->get_heartbeat_map()->reset_timeout(hb, 4, 0);
-       shardedpool_cond.WaitInterval(cct, shardedpool_lock, utime_t(2, 0));
+       cct->get_heartbeat_map()->reset_timeout(
+        hb,
+        wq->timeout_interval, wq->suicide_interval);
+       shardedpool_cond.WaitInterval(cct, shardedpool_lock,
+        utime_t(
+          cct->_conf->threadpool_empty_queue_max_wait, 0));
       }
       --num_paused;
       shardedpool_lock.Unlock();
@@ -318,14 +322,21 @@ void ShardedThreadPool::shardedthreadpool_worker(uint32_t thread_index)
         ++num_drained;
         wait_cond.Signal();
         while (drain_threads.read()) {
-          cct->get_heartbeat_map()->reset_timeout(hb, 4, 0);
-          shardedpool_cond.WaitInterval(cct, shardedpool_lock, utime_t(2, 0));
+         cct->get_heartbeat_map()->reset_timeout(
+           hb,
+           wq->timeout_interval, wq->suicide_interval);
+          shardedpool_cond.WaitInterval(cct, shardedpool_lock,
+           utime_t(
+             cct->_conf->threadpool_empty_queue_max_wait, 0));
         }
         --num_drained;
       }
       shardedpool_lock.Unlock();
     }
 
+    cct->get_heartbeat_map()->reset_timeout(
+      hb,
+      wq->timeout_interval, wq->suicide_interval);
     wq->_process(thread_index, hb);
 
   }