]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/pg: add an option to cap loop before we reset tp handle
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 23 Mar 2016 08:44:10 +0000 (16:44 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Wed, 23 Mar 2016 08:44:10 +0000 (16:44 +0800)
So we don't try to reset handle on every loop and this shall
save CPU a little bit.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/common/config_opts.h
src/osd/PG.cc

index aea9c169b63a3abedada5d100c4a4d2c9b2eef3c..6837c001461103b656af1abed1f0ee7061f641fa 100644 (file)
@@ -803,7 +803,7 @@ OPTION(osd_tracing, OPT_BOOL, false) // true if LTTng-UST tracepoints should be
 
 // determines whether PGLog::check() compares written out log to stored log
 OPTION(osd_debug_pg_log_writeout, OPT_BOOL, false)
-
+OPTION(osd_loop_before_reset_tphandle, OPT_U32, 64) // Max number of loop before we reset thread-pool's handle
 // default timeout while caling WaitInterval on an empty queue
 OPTION(threadpool_default_timeout, OPT_INT, 60)
 // default wait time for an empty queue before pinging the hb timeout
index 7eabe3b8d10892c7f021895ba0ee2ac8b13c6793..a0dd96ce2acdb15a6859ff263c84fafef1aae585 100644 (file)
@@ -506,14 +506,16 @@ bool PG::MissingLoc::add_source_info(
   ThreadPool::TPHandle* handle)
 {
   bool found_missing = false;
+  unsigned loop = 0;
   // found items?
   for (map<hobject_t,pg_missing_t::item, hobject_t::ComparatorWithDefault>::const_iterator p = needs_recovery_map.begin();
        p != needs_recovery_map.end();
        ++p) {
     const hobject_t &soid(p->first);
     eversion_t need = p->second.need;
-    if (handle) {
+    if (handle && ++loop >= g_conf->osd_loop_before_reset_tphandle) {
       handle->reset_tp_timeout();
+      loop = 0;
     }
     if (oinfo.last_update < need) {
       dout(10) << "search_for_missing " << soid << " " << need