diff options
63 files changed, 117 insertions, 105 deletions
diff --git a/src/ceph_fuse.cc b/src/ceph_fuse.cc index e593d0b2c91..70d8845f616 100644 --- a/src/ceph_fuse.cc +++ b/src/ceph_fuse.cc @@ -244,7 +244,7 @@ int main(int argc, const char **argv, const char *envp[]) { cerr << "ceph-fuse[" << getpid() << "]: starting fuse" << std::endl; tester.init(cfuse, client); - tester.create(); + tester.create("tester"); r = cfuse->loop(); tester.join(&tester_rp); tester_r = static_cast<int>(reinterpret_cast<uint64_t>(tester_rp)); diff --git a/src/client/SyntheticClient.cc b/src/client/SyntheticClient.cc index 5371ac01ee2..d2ab7ecc576 100644 --- a/src/client/SyntheticClient.cc +++ b/src/client/SyntheticClient.cc @@ -934,6 +934,7 @@ int SyntheticClient::start_thread() pthread_create(&thread_id, NULL, synthetic_client_thread_entry, this); assert(thread_id); + pthread_setname_np(thread_id, "client"); return 0; } diff --git a/src/common/Finisher.cc b/src/common/Finisher.cc index 9b39dc888e3..73900ddc20d 100644 --- a/src/common/Finisher.cc +++ b/src/common/Finisher.cc @@ -12,7 +12,7 @@ void Finisher::start() { ldout(cct, 10) << __func__ << dendl; - finisher_thread.create(); + finisher_thread.create(thread_name.c_str()); } void Finisher::stop() diff --git a/src/common/Finisher.h b/src/common/Finisher.h index 95db977a0ea..26a41b7461e 100644 --- a/src/common/Finisher.h +++ b/src/common/Finisher.h @@ -48,6 +48,8 @@ class Finisher { /// should be completed in that place instead. vector<Context*> finisher_queue; + string thread_name; + /// Queue for contexts for which the complete function will be called /// with a parameter other than 0. list<pair<Context*,int> > finisher_queue_rval; @@ -135,14 +137,14 @@ class Finisher { Finisher(CephContext *cct_) : cct(cct_), finisher_lock("Finisher::finisher_lock"), finisher_stop(false), finisher_running(false), - logger(0), + thread_name("fn_anonymous"), logger(0), finisher_thread(this) {} /// Construct a named Finisher that logs its queue length. - Finisher(CephContext *cct_, string name) : + Finisher(CephContext *cct_, string name, string tn) : cct(cct_), finisher_lock("Finisher::finisher_lock"), finisher_stop(false), finisher_running(false), - logger(0), + thread_name(tn), logger(0), finisher_thread(this) { PerfCountersBuilder b(cct, string("finisher-") + name, l_finisher_first, l_finisher_last); diff --git a/src/common/OutputDataSocket.cc b/src/common/OutputDataSocket.cc index e43f5cf95cb..a1c368b40aa 100644 --- a/src/common/OutputDataSocket.cc +++ b/src/common/OutputDataSocket.cc @@ -371,7 +371,7 @@ bool OutputDataSocket::init(const std::string &path) m_shutdown_rd_fd = pipe_rd; m_shutdown_wr_fd = pipe_wr; m_path = path; - create(); + create("out_data_socket"); add_cleanup_file(m_path.c_str()); return true; } diff --git a/src/common/Thread.cc b/src/common/Thread.cc index b917838f45b..4d40016a3c9 100644 --- a/src/common/Thread.cc +++ b/src/common/Thread.cc @@ -143,7 +143,7 @@ int Thread::try_create(size_t stacksize) return r; } -void Thread::create(size_t stacksize) +void Thread::create(const char *name, size_t stacksize) { int ret = try_create(stacksize); if (ret != 0) { @@ -152,6 +152,9 @@ void Thread::create(size_t stacksize) "failed with error %d", ret); dout_emergency(buf); assert(ret == 0); + } else if (thread_id > 0) { + assert(strlen(name) < 16); + pthread_setname_np(thread_id, name); } } diff --git a/src/common/Thread.h b/src/common/Thread.h index 98b76fde3b2..deced8f46cc 100644 --- a/src/common/Thread.h +++ b/src/common/Thread.h @@ -48,7 +48,7 @@ class Thread { bool am_self() const; int kill(int signal); int try_create(size_t stacksize); - void create(size_t stacksize = 0); + void create(const char *name, size_t stacksize = 0); int join(void **prval = 0); int detach(); int set_ioprio(int cls, int prio); diff --git a/src/common/Timer.cc b/src/common/Timer.cc index e49a70093c7..1160541acae 100644 --- a/src/common/Timer.cc +++ b/src/common/Timer.cc @@ -62,7 +62,7 @@ void SafeTimer::init() { ldout(cct,10) << "init" << dendl; thread = new SafeTimerThread(this); - thread->create(); + thread->create("safe_timer"); } void SafeTimer::shutdown() diff --git a/src/common/WorkQueue.cc b/src/common/WorkQueue.cc index 00666faca33..9d99fd1cbfd 100644 --- a/src/common/WorkQueue.cc +++ b/src/common/WorkQueue.cc @@ -27,8 +27,8 @@ #define dout_prefix *_dout << name << " " -ThreadPool::ThreadPool(CephContext *cct_, string nm, int n, const char *option) - : cct(cct_), name(nm), +ThreadPool::ThreadPool(CephContext *cct_, string nm, string tn, int n, const char *option) + : cct(cct_), name(nm), thread_name(tn), lockname(nm + "::lock"), _lock(lockname.c_str()), // this should be safe due to declaration order _stop(false), @@ -169,7 +169,7 @@ void ThreadPool::start_threads() if (r < 0) lderr(cct) << " set_ioprio got " << cpp_strerror(r) << dendl; - wt->create(); + wt->create(thread_name.c_str()); } } @@ -286,8 +286,8 @@ void ThreadPool::set_ioprio(int cls, int priority) } } -ShardedThreadPool::ShardedThreadPool(CephContext *pcct_, string nm, - uint32_t pnum_threads): cct(pcct_),name(nm),lockname(nm + "::lock"), +ShardedThreadPool::ShardedThreadPool(CephContext *pcct_, string nm, string tn, + uint32_t pnum_threads): cct(pcct_),name(nm),thread_name(tn),lockname(nm + "::lock"), shardedpool_lock(lockname.c_str()),num_threads(pnum_threads),stop_threads(0), pause_threads(0),drain_threads(0), num_paused(0), num_drained(0), wq(NULL) {} @@ -356,7 +356,7 @@ void ShardedThreadPool::start_threads() WorkThreadSharded *wt = new WorkThreadSharded(this, thread_index); ldout(cct, 10) << "start_threads creating and starting " << wt << dendl; threads_shardedpool.push_back(wt); - wt->create(); + wt->create(thread_name.c_str()); thread_index++; } } diff --git a/src/common/WorkQueue.h b/src/common/WorkQueue.h index a6e7972408f..a9a753378b4 100644 --- a/src/common/WorkQueue.h +++ b/src/common/WorkQueue.h @@ -28,6 +28,7 @@ class CephContext; class ThreadPool : public md_config_obs_t { CephContext *cct; string name; + string thread_name; string lockname; Mutex _lock; Cond _cond; @@ -459,7 +460,7 @@ private: void worker(WorkThread *wt); public: - ThreadPool(CephContext *cct_, string nm, int n, const char *option = NULL); + ThreadPool(CephContext *cct_, string nm, string tn, int n, const char *option = NULL); virtual ~ThreadPool(); /// return number of threads currently running @@ -618,6 +619,7 @@ class ShardedThreadPool { CephContext *cct; string name; + string thread_name; string lockname; Mutex shardedpool_lock; Cond shardedpool_cond; @@ -698,7 +700,7 @@ private: public: - ShardedThreadPool(CephContext *cct_, string nm, uint32_t pnum_threads); + ShardedThreadPool(CephContext *cct_, string nm, string tn, uint32_t pnum_threads); ~ShardedThreadPool(){}; diff --git a/src/common/admin_socket.cc b/src/common/admin_socket.cc index 07a2246e9e5..1d51ef54227 100644 --- a/src/common/admin_socket.cc +++ b/src/common/admin_socket.cc @@ -556,7 +556,7 @@ bool AdminSocket::init(const std::string &path) register_command("get_command_descriptions", "get_command_descriptions", m_getdescs_hook, "list available commands"); - create(); + create("admin_socket"); add_cleanup_file(m_path.c_str()); return true; } diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc index 4ead871e9b4..d37f631e987 100644 --- a/src/common/ceph_context.cc +++ b/src/common/ceph_context.cc @@ -547,7 +547,7 @@ void CephContext::start_service_thread() return; } _service_thread = new CephContextServiceThread(this); - _service_thread->create(); + _service_thread->create("service"); ceph_spin_unlock(&_service_thread_lock); // make logs flush on_exit() diff --git a/src/common/obj_bencher.cc b/src/common/obj_bencher.cc index 9ecfbec4d31..525a5426412 100644 --- a/src/common/obj_bencher.cc +++ b/src/common/obj_bencher.cc @@ -390,6 +390,7 @@ int ObjBencher::write_bench(int secondsToRun, pthread_t print_thread; pthread_create(&print_thread, NULL, ObjBencher::status_printer, (void *)this); + pthread_setname_np(print_thread, "write_stat"); lock.Lock(); data.finished = 0; data.start_time = ceph_clock_now(cct); @@ -610,6 +611,7 @@ int ObjBencher::seq_read_bench(int seconds_to_run, int num_objects, int concurre pthread_t print_thread; pthread_create(&print_thread, NULL, status_printer, (void *)this); + pthread_setname_np(print_thread, "seq_read_stat"); utime_t finish_time = data.start_time + time_to_run; //start initial reads @@ -830,6 +832,7 @@ int ObjBencher::rand_read_bench(int seconds_to_run, int num_objects, int concurr pthread_t print_thread; pthread_create(&print_thread, NULL, status_printer, (void *)this); + pthread_setname_np(print_thread, "rand_read_stat"); utime_t finish_time = data.start_time + time_to_run; //start initial reads diff --git a/src/compressor/AsyncCompressor.cc b/src/compressor/AsyncCompressor.cc index 564d6147330..cdd666701e2 100644 --- a/src/compressor/AsyncCompressor.cc +++ b/src/compressor/AsyncCompressor.cc @@ -23,7 +23,7 @@ AsyncCompressor::AsyncCompressor(CephContext *c): compressor(Compressor::create(c->_conf->async_compressor_type)), cct(c), job_id(0), - compress_tp(g_ceph_context, "AsyncCompressor::compressor_tp", cct->_conf->async_compressor_threads, "async_compressor_threads"), + compress_tp(g_ceph_context, "AsyncCompressor::compressor_tp", "tp_async_compr", cct->_conf->async_compressor_threads, "async_compressor_threads"), job_lock("AsyncCompressor::job_lock"), compress_wq(this, c->_conf->async_compressor_thread_timeout, c->_conf->async_compressor_thread_suicide_timeout, &compress_tp) { } diff --git a/src/global/signal_handler.cc b/src/global/signal_handler.cc index 120767650eb..6254646865d 100644 --- a/src/global/signal_handler.cc +++ b/src/global/signal_handler.cc @@ -192,7 +192,7 @@ struct SignalHandler : public Thread { assert(r == 0); // create thread - create(); + create("sginal_handler"); } ~SignalHandler() { diff --git a/src/kv/LevelDBStore.cc b/src/kv/LevelDBStore.cc index 481fbf16d04..a3d4617c65d 100644 --- a/src/kv/LevelDBStore.cc +++ b/src/kv/LevelDBStore.cc @@ -378,6 +378,6 @@ void LevelDBStore::compact_range_async(const string& start, const string& end) } compact_queue_cond.Signal(); if (!compact_thread.is_started()) { - compact_thread.create(); + compact_thread.create("levdbst_compact"); } } diff --git a/src/kv/RocksDBStore.cc b/src/kv/RocksDBStore.cc index d03d913b320..93c8ee9bbe4 100644 --- a/src/kv/RocksDBStore.cc +++ b/src/kv/RocksDBStore.cc @@ -514,7 +514,7 @@ void RocksDBStore::compact_range_async(const string& start, const string& end) } compact_queue_cond.Signal(); if (!compact_thread.is_started()) { - compact_thread.create(); + compact_thread.create("rstore_commpact"); } } bool RocksDBStore::check_omap_dir(string &omap_dir) diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc index ef15e2df602..84d74d2772c 100644 --- a/src/librbd/ImageCtx.cc +++ b/src/librbd/ImageCtx.cc @@ -47,7 +47,7 @@ namespace { class ThreadPoolSingleton : public ThreadPool { public: ThreadPoolSingleton(CephContext *cct) - : ThreadPool(cct, "librbd::thread_pool", cct->_conf->rbd_op_threads, + : ThreadPool(cct, "librbd::thread_pool", "tp_librbd", cct->_conf->rbd_op_threads, "rbd_op_threads") { start(); } diff --git a/src/log/Log.cc b/src/log/Log.cc index 860b2c7cdb9..8be66115c9a 100644 --- a/src/log/Log.cc +++ b/src/log/Log.cc @@ -343,7 +343,7 @@ void Log::start() pthread_mutex_lock(&m_queue_mutex); m_stop = false; pthread_mutex_unlock(&m_queue_mutex); - create(); + create("log"); } void Log::stop() diff --git a/src/mds/MDLog.cc b/src/mds/MDLog.cc index 43cdc485035..c8817b5eb4a 100644 --- a/src/mds/MDLog.cc +++ b/src/mds/MDLog.cc @@ -169,7 +169,7 @@ void MDLog::create(MDSInternalContextBase *c) logger->set(l_mdl_expos, journaler->get_expire_pos()); logger->set(l_mdl_wrpos, journaler->get_write_pos()); - submit_thread.create(); + submit_thread.create("md_submit"); } void MDLog::open(MDSInternalContextBase *c) @@ -177,9 +177,9 @@ void MDLog::open(MDSInternalContextBase *c) dout(5) << "open discovering log bounds" << dendl; recovery_thread.set_completion(c); - recovery_thread.create(); + recovery_thread.create("md_recov_open"); - submit_thread.create(); + submit_thread.create("md_submit"); // either append() or replay() will follow. } @@ -216,7 +216,7 @@ void MDLog::reopen(MDSInternalContextBase *c) journaler = NULL; recovery_thread.set_completion(new C_ReopenComplete(this, c)); - recovery_thread.create(); + recovery_thread.create("md_recov_reopen"); } void MDLog::append() @@ -842,7 +842,7 @@ void MDLog::replay(MDSInternalContextBase *c) assert(num_events == 0 || already_replayed); already_replayed = true; - replay_thread.create(); + replay_thread.create("md_log_replay"); } diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index fcb8efdda4b..d284296b313 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -142,7 +142,7 @@ void MDSRankDispatcher::init() // who is interested in it. handle_osd_map(); - progress_thread.create(); + progress_thread.create("mds_rank_progr"); finisher->start(); } diff --git a/src/mon/MonitorDBStore.h b/src/mon/MonitorDBStore.h index 81016417ec9..6d44e6adc06 100644 --- a/src/mon/MonitorDBStore.h +++ b/src/mon/MonitorDBStore.h @@ -630,7 +630,7 @@ class MonitorDBStore do_dump(false), dump_fd_binary(-1), dump_fmt(true), - io_work(g_ceph_context, "monstore"), + io_work(g_ceph_context, "monstore", "fn_monstore"), is_open(false) { string::const_reverse_iterator rit; int pos = 0; diff --git a/src/msg/async/AsyncMessenger.cc b/src/msg/async/AsyncMessenger.cc index 524c6015e24..258e8dd5dc4 100644 --- a/src/msg/async/AsyncMessenger.cc +++ b/src/msg/async/AsyncMessenger.cc @@ -344,7 +344,7 @@ void WorkerPool::start() { if (!started) { for (uint64_t i = 0; i < workers.size(); ++i) { - workers[i]->create(); + workers[i]->create("ms_async_worker"); } started = true; } diff --git a/src/msg/simple/Accepter.cc b/src/msg/simple/Accepter.cc index a8aa4955a98..3d6f1f7a5e7 100644 --- a/src/msg/simple/Accepter.cc +++ b/src/msg/simple/Accepter.cc @@ -208,7 +208,7 @@ int Accepter::start() ldout(msgr->cct,1) << "accepter.start" << dendl; // start thread - create(); + create("ms_accepter"); return 0; } diff --git a/src/msg/simple/DispatchQueue.cc b/src/msg/simple/DispatchQueue.cc index 500239f29ab..6f7495ef520 100644 --- a/src/msg/simple/DispatchQueue.cc +++ b/src/msg/simple/DispatchQueue.cc @@ -217,8 +217,8 @@ void DispatchQueue::start() { assert(!stop); assert(!dispatch_thread.is_started()); - dispatch_thread.create(); - local_delivery_thread.create(); + dispatch_thread.create("ms_dispatch"); + local_delivery_thread.create("ms_local"); } void DispatchQueue::wait() diff --git a/src/msg/simple/Pipe.cc b/src/msg/simple/Pipe.cc index 33884c81cda..9658ffba836 100644 --- a/src/msg/simple/Pipe.cc +++ b/src/msg/simple/Pipe.cc @@ -135,7 +135,7 @@ void Pipe::start_reader() reader_needs_join = false; } reader_running = true; - reader_thread.create(msgr->cct->_conf->ms_rwthread_stack_bytes); + reader_thread.create("ms_pipe_read", msgr->cct->_conf->ms_rwthread_stack_bytes); } void Pipe::maybe_start_delay_thread() @@ -144,7 +144,7 @@ void Pipe::maybe_start_delay_thread() msgr->cct->_conf->ms_inject_delay_type.find(ceph_entity_type_name(connection_state->peer_type)) != string::npos) { lsubdout(msgr->cct, ms, 1) << "setting up a delay queue on Pipe " << this << dendl; delay_thread = new DelayedDelivery(this); - delay_thread->create(); + delay_thread->create("ms_pipe_delay"); } } @@ -153,7 +153,7 @@ void Pipe::start_writer() assert(pipe_lock.is_locked()); assert(!writer_running); writer_running = true; - writer_thread.create(msgr->cct->_conf->ms_rwthread_stack_bytes); + writer_thread.create("ms_pipe_write", msgr->cct->_conf->ms_rwthread_stack_bytes); } void Pipe::join_reader() diff --git a/src/msg/simple/SimpleMessenger.cc b/src/msg/simple/SimpleMessenger.cc index fdb7278292d..9d5f3c9c0cf 100644 --- a/src/msg/simple/SimpleMessenger.cc +++ b/src/msg/simple/SimpleMessenger.cc @@ -329,7 +329,7 @@ int SimpleMessenger::start() lock.Unlock(); reaper_started = true; - reaper_thread.create(); + reaper_thread.create("ms_reaper"); return 0; } diff --git a/src/os/bluestore/BlockDevice.cc b/src/os/bluestore/BlockDevice.cc index 073a02cdc47..80d828208ff 100644 --- a/src/os/bluestore/BlockDevice.cc +++ b/src/os/bluestore/BlockDevice.cc @@ -194,7 +194,7 @@ int BlockDevice::_aio_start() derr << __func__ << " failed: " << cpp_strerror(r) << dendl; return r; } - aio_thread.create(); + aio_thread.create("bstore_aio"); } return 0; } diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index bb033fd9496..91cf311f5f8 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -771,6 +771,7 @@ BlueStore::BlueStore(CephContext *cct, const string& path) wal_seq(0), wal_tp(cct, "BlueStore::wal_tp", + "tp_wal", cct->_conf->bluestore_wal_threads, "bluestore_wal_threads"), wal_wq(this, @@ -1690,7 +1691,7 @@ int BlueStore::mount() finisher.start(); wal_tp.start(); - kv_sync_thread.create(); + kv_sync_thread.create("bstore_kv_sync"); r = _wal_replay(); if (r < 0) diff --git a/src/os/filestore/FileJournal.cc b/src/os/filestore/FileJournal.cc index f9e0cc5131b..fa4751bf66e 100644 --- a/src/os/filestore/FileJournal.cc +++ b/src/os/filestore/FileJournal.cc @@ -691,10 +691,10 @@ void FileJournal::start_writer() { write_stop = false; aio_stop = false; - write_thread.create(); + write_thread.create("journal_write"); #ifdef HAVE_LIBAIO if (aio) - write_finish_thread.create(); + write_finish_thread.create("journal_wrt_fin"); #endif } diff --git a/src/os/filestore/FileStore.cc b/src/os/filestore/FileStore.cc index de2df61a0c4..fa3db26f3ce 100644 --- a/src/os/filestore/FileStore.cc +++ b/src/os/filestore/FileStore.cc @@ -518,11 +518,11 @@ FileStore::FileStore(const std::string &base, const std::string &jdev, osflagbit fdcache(g_ceph_context), wbthrottle(g_ceph_context), next_osr_id(0), - throttle_ops(g_ceph_context, "filestore_ops",g_conf->filestore_queue_max_ops), - throttle_bytes(g_ceph_context, "filestore_bytes",g_conf->filestore_queue_max_bytes), + throttle_ops(g_ceph_context, "filestore_ops", g_conf->filestore_queue_max_ops), + throttle_bytes(g_ceph_context, "filestore_bytes", g_conf->filestore_queue_max_bytes), m_ondisk_finisher_num(g_conf->filestore_ondisk_finisher_threads), m_apply_finisher_num(g_conf->filestore_apply_finisher_threads), - op_tp(g_ceph_context, "FileStore::op_tp", g_conf->filestore_op_threads, "filestore_op_threads"), + op_tp(g_ceph_context, "FileStore::op_tp", "tp_fstore_op", g_conf->filestore_op_threads, "filestore_op_threads"), op_wq(this, g_conf->filestore_op_thread_timeout, g_conf->filestore_op_thread_suicide_timeout, &op_tp), logger(NULL), @@ -559,13 +559,13 @@ FileStore::FileStore(const std::string &base, const std::string &jdev, osflagbit for (int i = 0; i < m_ondisk_finisher_num; ++i) { ostringstream oss; oss << "filestore-ondisk-" << i; - Finisher *f = new Finisher(g_ceph_context, oss.str()); + Finisher *f = new Finisher(g_ceph_context, oss.str(), "fn_odsk_fstore"); ondisk_finishers.push_back(f); } for (int i = 0; i < m_apply_finisher_num; ++i) { ostringstream oss; oss << "filestore-apply-" << i; - Finisher *f = new Finisher(g_ceph_context, oss.str()); + Finisher *f = new Finisher(g_ceph_context, oss.str(), "fn_appl_fstore"); apply_finishers.push_back(f); } @@ -1592,7 +1592,7 @@ int FileStore::mount() } wbthrottle.start(); - sync_thread.create(); + sync_thread.create("filestore_sync"); if (!(generic_flags & SKIP_JOURNAL_REPLAY)) { ret = journal_replay(initial_op_seq); diff --git a/src/os/filestore/JournalingObjectStore.h b/src/os/filestore/JournalingObjectStore.h index e757526b749..f384ba6a1b2 100644 --- a/src/os/filestore/JournalingObjectStore.h +++ b/src/os/filestore/JournalingObjectStore.h @@ -132,7 +132,7 @@ public: JournalingObjectStore(const std::string& path) : ObjectStore(path), journal(NULL), - finisher(g_ceph_context, "JournalObjectStore"), + finisher(g_ceph_context, "JournalObjectStore", "fn_jrn_objstore"), apply_manager(journal, finisher), replaying(false) {} diff --git a/src/os/filestore/WBThrottle.cc b/src/os/filestore/WBThrottle.cc index 6eb559dc016..fb98c97536c 100644 --- a/src/os/filestore/WBThrottle.cc +++ b/src/os/filestore/WBThrottle.cc @@ -49,7 +49,7 @@ void WBThrottle::start() Mutex::Locker l(lock); stopping = false; } - create(); + create("wb_throttle"); } void WBThrottle::stop() diff --git a/src/os/keyvaluestore/KeyValueStore.cc b/src/os/keyvaluestore/KeyValueStore.cc index 35eb6f4489f..b0f98f13c5a 100644 --- a/src/os/keyvaluestore/KeyValueStore.cc +++ b/src/os/keyvaluestore/KeyValueStore.cc @@ -533,7 +533,7 @@ KeyValueStore::KeyValueStore(const std::string &base, throttle_ops(g_ceph_context, "keyvaluestore_ops", g_conf->keyvaluestore_queue_max_ops), throttle_bytes(g_ceph_context, "keyvaluestore_bytes", g_conf->keyvaluestore_queue_max_bytes), op_finisher(g_ceph_context), - op_tp(g_ceph_context, "KeyValueStore::op_tp", + op_tp(g_ceph_context, "KeyValueStore::op_tp", "tp_kvstore", g_conf->keyvaluestore_op_threads, "keyvaluestore_op_threads"), op_wq(this, g_conf->keyvaluestore_op_thread_timeout, g_conf->keyvaluestore_op_thread_suicide_timeout, &op_tp), diff --git a/src/os/kstore/KStore.cc b/src/os/kstore/KStore.cc index 039f06981e9..0a4658d37a8 100644 --- a/src/os/kstore/KStore.cc +++ b/src/os/kstore/KStore.cc @@ -1011,7 +1011,7 @@ int KStore::mount() goto out_db; finisher.start(); - kv_sync_thread.create(); + kv_sync_thread.create("kstore_kv_sync"); mounted = true; return 0; diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 70a59810b19..cdb138154f7 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -482,7 +482,7 @@ void OSDService::init() watch_timer.init(); agent_timer.init(); - agent_thread.create(); + agent_thread.create("osd_srv_agent"); } void OSDService::final_init() @@ -1553,12 +1553,12 @@ OSD::OSD(CephContext *cct_, ObjectStore *store_, asok_hook(NULL), osd_compat(get_osd_compat_set()), state(STATE_INITIALIZING), - osd_tp(cct, "OSD::osd_tp", cct->_conf->osd_op_threads, "osd_op_threads"), - osd_op_tp(cct, "OSD::osd_op_tp", + osd_tp(cct, "OSD::osd_tp", "tp_osd", cct->_conf->osd_op_threads, "osd_op_threads"), + osd_op_tp(cct, "OSD::osd_op_tp", "tp_osd_tp", cct->_conf->osd_op_num_threads_per_shard * cct->_conf->osd_op_num_shards), - recovery_tp(cct, "OSD::recovery_tp", cct->_conf->osd_recovery_threads, "osd_recovery_threads"), - disk_tp(cct, "OSD::disk_tp", cct->_conf->osd_disk_threads, "osd_disk_threads"), - command_tp(cct, "OSD::command_tp", 1), + recovery_tp(cct, "OSD::recovery_tp", "tp_osd_recov", cct->_conf->osd_recovery_threads, "osd_recovery_threads"), + disk_tp(cct, "OSD::disk_tp", "tp_osd_disk", cct->_conf->osd_disk_threads, "osd_disk_threads"), + command_tp(cct, "OSD::command_tp", "tp_osd_cmd", 1), paused_recovery(false), session_waiting_lock("OSD::session_waiting_lock"), heartbeat_lock("OSD::heartbeat_lock"), @@ -1960,7 +1960,7 @@ int OSD::init() set_disk_tp_priority(); // start the heartbeat - heartbeat_thread.create(); + heartbeat_thread.create("osd_srv_heartbt"); // tick tick_timer.add_event_after(cct->_conf->osd_heartbeat_interval, new C_Tick(this)); diff --git a/src/osdc/ObjectCacher.h b/src/osdc/ObjectCacher.h index 841ee1fd2e8..f9283f87fd7 100644 --- a/src/osdc/ObjectCacher.h +++ b/src/osdc/ObjectCacher.h @@ -613,7 +613,7 @@ class ObjectCacher { ~ObjectCacher(); void start() { - flusher_thread.create(); + flusher_thread.create("flusher"); } void stop() { assert(flusher_thread.is_started()); diff --git a/src/rgw/rgw_bucket.h b/src/rgw/rgw_bucket.h index 9191fbe8651..6216a3b09de 100644 --- a/src/rgw/rgw_bucket.h +++ b/src/rgw/rgw_bucket.h @@ -375,7 +375,7 @@ public: } renew_thread = new ChangesRenewThread(cct, this); - renew_thread->create(); + renew_thread->create("rgw_dt_lg_renew"); } ~RGWDataChangesLog(); diff --git a/src/rgw/rgw_gc.cc b/src/rgw/rgw_gc.cc index 3a949b6821a..05fcbe3e2ff 100644 --- a/src/rgw/rgw_gc.cc +++ b/src/rgw/rgw_gc.cc @@ -259,7 +259,7 @@ bool RGWGC::going_down() void RGWGC::start_processor() { worker = new GCWorker(cct, this); - worker->create(); + worker->create("rgw_gc"); } void RGWGC::stop_processor() diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index 2246b6a40ea..aa0d11bce8b 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -243,7 +243,7 @@ protected: public: RGWProcess(CephContext *cct, RGWProcessEnv *pe, int num_threads, RGWFrontendConfig *_conf) - : store(pe->store), olog(pe->olog), m_tp(cct, "RGWProcess::m_tp", num_threads), + : store(pe->store), olog(pe->olog), m_tp(cct, "RGWProcess::m_tp", "tp_rgw_process", num_threads), req_throttle(cct, "rgw_ops", num_threads * 2), rest(pe->rest), conf(_conf), @@ -884,7 +884,7 @@ public: int run() { assert(pprocess); /* should have initialized by init() */ thread = new RGWProcessControlThread(pprocess); - thread->create(); + thread->create("rgw_frontend"); return 0; } diff --git a/src/rgw/rgw_object_expirer_core.cc b/src/rgw/rgw_object_expirer_core.cc index 14957d7448c..56bb59f1735 100644 --- a/src/rgw/rgw_object_expirer_core.cc +++ b/src/rgw/rgw_object_expirer_core.cc @@ -218,7 +218,7 @@ bool RGWObjectExpirer::going_down() void RGWObjectExpirer::start_processor() { worker = new OEWorker(store->ctx(), this); - worker->create(); + worker->create("rgw_obj_expirer"); } void RGWObjectExpirer::stop_processor() diff --git a/src/rgw/rgw_quota.cc b/src/rgw/rgw_quota.cc index 03c152db9df..c300c4432a0 100644 --- a/src/rgw/rgw_quota.cc +++ b/src/rgw/rgw_quota.cc @@ -516,9 +516,9 @@ public: rwlock("RGWUserStatsCache::rwlock") { if (quota_threads) { buckets_sync_thread = new BucketsSyncThread(store->ctx(), this); - buckets_sync_thread->create(); + buckets_sync_thread->create("rgw_buck_st_syn"); user_sync_thread = new UserSyncThread(store->ctx(), this); - user_sync_thread->create(); + user_sync_thread->create("rgw_user_st_syn"); } else { buckets_sync_thread = NULL; user_sync_thread = NULL; diff --git a/src/rgw/rgw_swift.cc b/src/rgw/rgw_swift.cc index 8d73602858b..b51d37f8afa 100644 --- a/src/rgw/rgw_swift.cc +++ b/src/rgw/rgw_swift.cc @@ -716,7 +716,7 @@ void RGWSwift::init_keystone() keystone_token_cache = new RGWKeystoneTokenCache(cct, cct->_conf->rgw_keystone_token_cache_size); keystone_revoke_thread = new KeystoneRevokeThread(cct, this); - keystone_revoke_thread->create(); + keystone_revoke_thread->create("rgw_swift_k_rev"); } diff --git a/src/test/bench/dumb_backend.h b/src/test/bench/dumb_backend.h index b3a19a7b936..38e160db76f 100644 --- a/src/test/bench/dumb_backend.h +++ b/src/test/bench/dumb_backend.h @@ -123,13 +123,13 @@ public: do_fadvise(do_fadvise), sync_interval(sync_interval), sync_fd(sync_fd), - tp(cct, "DumbBackend::tp", worker_threads), + tp(cct, "DumbBackend::tp", "tp_dumb_backend", worker_threads), thread(this), sync_loop_mutex("DumbBackend::sync_loop_mutex"), sync_loop_stop(0), pending_commit_mutex("DumbBackend::pending_commit_mutex"), queue(this, 20, &tp) { - thread.create(); + thread.create("thread"); tp.start(); for (unsigned i = 0; i < 10*worker_threads; ++i) { sem.Put(); diff --git a/src/test/bench/small_io_bench_fs.cc b/src/test/bench/small_io_bench_fs.cc index 55b2aaeba7b..75ec0516493 100644 --- a/src/test/bench/small_io_bench_fs.cc +++ b/src/test/bench/small_io_bench_fs.cc @@ -236,7 +236,7 @@ int main(int argc, char **argv) for (vector<ceph::shared_ptr<Bencher> >::iterator i = benchers.begin(); i != benchers.end(); ++i) { - (*i)->create(); + (*i)->create("bencher"); } for (vector<ceph::shared_ptr<Bencher> >::iterator i = benchers.begin(); i != benchers.end(); diff --git a/src/test/bench/tp_bench.cc b/src/test/bench/tp_bench.cc index 23185a76977..6bc6be10a18 100644 --- a/src/test/bench/tp_bench.cc +++ b/src/test/bench/tp_bench.cc @@ -173,7 +173,7 @@ int main(int argc, char **argv) if (*i == 'q') { ThreadPool *tp = new ThreadPool( - g_ceph_context, ss.str(), vm["num-threads"].as<unsigned>(), 0); + g_ceph_context, ss.str(), "tp_test", vm["num-threads"].as<unsigned>(), 0); wqs.push_back( new WQWrapper( new PassAlong(tp, wqs.back()), diff --git a/src/test/bench_log.cc b/src/test/bench_log.cc index 2cbfa1e77d2..a80e14a5e81 100644 --- a/src/test/bench_log.cc +++ b/src/test/bench_log.cc @@ -46,7 +46,7 @@ int main(int argc, const char **argv) list<T*> ls; for (int i=0; i<threads; i++) { T *t = new T(num); - t->create(); + t->create("t"); ls.push_back(t); } diff --git a/src/test/common/Throttle.cc b/src/test/common/Throttle.cc index 7ae98b51609..bd30471a809 100644 --- a/src/test/common/Throttle.cc +++ b/src/test/common/Throttle.cc @@ -107,7 +107,7 @@ TEST_F(ThrottleTest, get) { ASSERT_FALSE(throttle.get_or_fail(throttle_max)); Thread_get t(throttle, 7); - t.create(); + t.create("t_throttle_1"); usleep(delay); ASSERT_EQ(throttle.put(throttle_max), 0); t.join(); @@ -123,11 +123,11 @@ TEST_F(ThrottleTest, get) { ASSERT_FALSE(throttle.get_or_fail(throttle_max)); Thread_get t(throttle, throttle_max); - t.create(); + t.create("t_throttle_2"); usleep(delay); Thread_get u(throttle, 1); - u.create(); + u.create("u_throttle_2"); usleep(delay); throttle.put(throttle_max / 2); @@ -188,7 +188,7 @@ TEST_F(ThrottleTest, wait) { ASSERT_FALSE(throttle.get_or_fail(throttle_max)); Thread_get t(throttle, throttle_max); - t.create(); + t.create("t_throttle_3"); usleep(delay); // @@ -223,7 +223,7 @@ TEST_F(ThrottleTest, destructor) { ASSERT_FALSE(throttle->get(5)); t = new Thread_get(*throttle, 7); - t->create(); + t->create("t_throttle"); bool blocked; useconds_t delay = 1; do { diff --git a/src/test/common/test_shared_cache.cc b/src/test/common/test_shared_cache.cc index 09f6fb1dc17..cd921f52707 100644 --- a/src/test/common/test_shared_cache.cc +++ b/src/test/common/test_shared_cache.cc @@ -175,7 +175,7 @@ TEST_F(SharedLRU_all, wait_lookup) { EXPECT_FALSE(cache.get_weak_refs()[key].first.lock()); Thread_wait t(cache, key, value, Thread_wait::LOOKUP); - t.create(); + t.create("wait_lookup_1"); ASSERT_TRUE(wait_for(cache, 1)); EXPECT_EQ(value, *t.ptr); // waiting on a key does not block lookups on other keys @@ -201,7 +201,7 @@ TEST_F(SharedLRU_all, wait_lookup_or_create) { EXPECT_FALSE(cache.get_weak_refs()[key].first.lock()); Thread_wait t(cache, key, value, Thread_wait::LOOKUP); - t.create(); + t.create("wait_lookup_2"); ASSERT_TRUE(wait_for(cache, 1)); EXPECT_EQ(value, *t.ptr); // waiting on a key does not block lookups on other keys @@ -246,7 +246,7 @@ TEST_F(SharedLRU_all, wait_lower_bound) { EXPECT_FALSE(cache.get_weak_refs()[key].first.lock()); Thread_wait t(cache, key, value, Thread_wait::LOWER_BOUND); - t.create(); + t.create("wait_lower_bnd"); ASSERT_TRUE(wait_for(cache, 1)); EXPECT_FALSE(t.ptr); // waiting on a key does not block getting lower_bound on other keys diff --git a/src/test/common/test_sharedptr_registry.cc b/src/test/common/test_sharedptr_registry.cc index 42bc8e607ac..98379c856aa 100644 --- a/src/test/common/test_sharedptr_registry.cc +++ b/src/test/common/test_sharedptr_registry.cc @@ -130,7 +130,7 @@ TEST_F(SharedPtrRegistry_all, wait_lookup_or_create) { EXPECT_FALSE(registry.get_contents()[key].first.lock()); Thread_wait t(registry, key, 0, Thread_wait::LOOKUP_OR_CREATE); - t.create(); + t.create("wait_lookcreate"); ASSERT_TRUE(wait_for(registry, 1)); EXPECT_FALSE(t.ptr); // waiting on a key does not block lookups on other keys @@ -150,7 +150,7 @@ TEST_F(SharedPtrRegistry_all, wait_lookup_or_create) { EXPECT_FALSE(registry.get_contents()[key].first.lock()); Thread_wait t(registry, key, value, Thread_wait::LOOKUP_OR_CREATE); - t.create(); + t.create("wait_lookcreate"); ASSERT_TRUE(wait_for(registry, 1)); EXPECT_FALSE(t.ptr); // waiting on a key does not block lookups on other keys @@ -193,7 +193,7 @@ TEST_F(SharedPtrRegistry_all, wait_lookup) { EXPECT_FALSE(registry.get_contents()[key].first.lock()); Thread_wait t(registry, key, value, Thread_wait::LOOKUP); - t.create(); + t.create("wait_lookup"); ASSERT_TRUE(wait_for(registry, 1)); EXPECT_EQ(value, *t.ptr); // waiting on a key does not block lookups on other keys diff --git a/src/test/erasure-code/TestErasureCodePlugin.cc b/src/test/erasure-code/TestErasureCodePlugin.cc index 6cf241e448b..4691ff6e23d 100644 --- a/src/test/erasure-code/TestErasureCodePlugin.cc +++ b/src/test/erasure-code/TestErasureCodePlugin.cc @@ -55,7 +55,7 @@ TEST_F(ErasureCodePluginRegistryTest, factory_mutex) { useconds_t delay = 0; const useconds_t DELAY_MAX = 20 * 1000 * 1000; Thread_factory sleep_forever; - sleep_forever.create(); + sleep_forever.create("sleep_forever"); do { cout << "Trying (1) with delay " << delay << "us\n"; if (delay > 0) diff --git a/src/test/librbd/test_librbd.cc b/src/test/librbd/test_librbd.cc index 1f072b77320..15f5084f9e1 100644 --- a/src/test/librbd/test_librbd.cc +++ b/src/test/librbd/test_librbd.cc @@ -3223,7 +3223,7 @@ TEST_F(TestLibRBD, ObjectMapConsistentSnap) ASSERT_EQ(0, rbd.open(ioctx, image1, name.c_str(), NULL)); RBDWriter writer(image1); - writer.create(); + writer.create("rbd_writer"); int num_snaps = 10; for (int i = 0; i < num_snaps; ++i) { diff --git a/src/test/msgr/perf_msgr_client.cc b/src/test/msgr/perf_msgr_client.cc index 17c4aca3e03..fa21b493119 100644 --- a/src/test/msgr/perf_msgr_client.cc +++ b/src/test/msgr/perf_msgr_client.cc @@ -142,7 +142,7 @@ class MessengerClient { } void start() { for (uint64_t i = 0; i < clients.size(); ++i) - clients[i]->create(); + clients[i]->create("client"); for (uint64_t i = 0; i < msgrs.size(); ++i) msgrs[i]->wait(); } diff --git a/src/test/msgr/perf_msgr_server.cc b/src/test/msgr/perf_msgr_server.cc index b38a76ab1a2..3989cd23490 100644 --- a/src/test/msgr/perf_msgr_server.cc +++ b/src/test/msgr/perf_msgr_server.cc @@ -72,7 +72,7 @@ class ServerDispatcher : public Dispatcher { public: ServerDispatcher(int threads, uint64_t delay): Dispatcher(g_ceph_context), think_time(delay), - op_tp(g_ceph_context, "ServerDispatcher::op_tp", threads, "serverdispatcher_op_threads"), + op_tp(g_ceph_context, "ServerDispatcher::op_tp", "tp_serv_disp", threads, "serverdispatcher_op_threads"), op_wq(30, 30, &op_tp) { op_tp.start(); } diff --git a/src/test/msgr/test_async_driver.cc b/src/test/msgr/test_async_driver.cc index 1d6d2900b7c..a25eef337bb 100644 --- a/src/test/msgr/test_async_driver.cc +++ b/src/test/msgr/test_async_driver.cc @@ -307,8 +307,8 @@ TEST(EventCenterTest, DispatchTest) { atomic_t count(0); Mutex lock("DispatchTest::lock"); Cond cond; - worker1.create(); - worker2.create(); + worker1.create("worker_1"); + worker2.create("worker_2"); for (int i = 0; i < 10000; ++i) { count.inc(); worker1.center.dispatch_event_external(EventCallbackRef(new CountEvent(&count, &lock, &cond))); diff --git a/src/test/osd/types.cc b/src/test/osd/types.cc index c28ed0df05a..ec4fc3d02b5 100644 --- a/src/test/osd/types.cc +++ b/src/test/osd/types.cc @@ -1161,7 +1161,7 @@ TEST_F(ObjectContextTest, read_write_lock) EXPECT_EQ(1, obc.unstable_writes); Thread_read_lock t(obc); - t.create(); + t.create("obc_read"); do { cout << "Trying (1) with delay " << delay << "us\n"; @@ -1218,7 +1218,7 @@ TEST_F(ObjectContextTest, read_write_lock) EXPECT_EQ(0, obc.unstable_writes); Thread_write_lock t(obc); - t.create(); + t.create("obc_write"); do { cout << "Trying (3) with delay " << delay << "us\n"; diff --git a/src/test/perf_local.cc b/src/test/perf_local.cc index 9672be2553b..fe642588f4c 100644 --- a/src/test/perf_local.cc +++ b/src/test/perf_local.cc @@ -340,7 +340,7 @@ class CondPingPong { CondPingPong(): mutex("CondPingPong::mutex"), prod(0), cons(0), count(10000), consumer(this) {} double run() { - consumer.create(); + consumer.create("consumer"); uint64_t start = Cycles::rdtsc(); produce(); uint64_t stop = Cycles::rdtsc(); @@ -498,7 +498,7 @@ double eventcenter_dispatch() CenterWorker worker(g_ceph_context); atomic_t flag(1); - worker.create(); + worker.create("evt_center_disp"); EventCallbackRef count_event(new CountEvent(&flag)); worker.center.dispatch_event_external(count_event); @@ -759,7 +759,7 @@ double spawn_thread() ThreadHelper thread; uint64_t start = Cycles::rdtsc(); for (int i = 0; i < count; i++) { - thread.create(); + thread.create("thread_helper"); thread.join(); } uint64_t stop = Cycles::rdtsc(); diff --git a/src/test/test_snap_mapper.cc b/src/test/test_snap_mapper.cc index 873e88cc3ae..17cb898c760 100644 --- a/src/test/test_snap_mapper.cc +++ b/src/test/test_snap_mapper.cc @@ -167,7 +167,7 @@ private: public: PausyAsyncMap() : lock("PausyAsyncMap"), doer(this) { - doer.create(); + doer.create("doer"); } ~PausyAsyncMap() { doer.join(); diff --git a/src/test/test_stress_watch.cc b/src/test/test_stress_watch.cc index 6ddfee5047f..cafdc20e6e8 100644 --- a/src/test/test_stress_watch.cc +++ b/src/test/test_stress_watch.cc @@ -76,7 +76,7 @@ TEST_P(WatchStress, Stress1) { WatchNotifyTestCtx ctx; WatcherUnwatcher *thr = new WatcherUnwatcher(pool_name); - thr->create(); + thr->create("watcher_unwatch"); ASSERT_EQ(0, nioctx.create("foo", false)); for (unsigned i = 0; i < 75; ++i) { diff --git a/src/test/test_trans.cc b/src/test/test_trans.cc index b55de59ba83..415dea34dc7 100644 --- a/src/test/test_trans.cc +++ b/src/test/test_trans.cc @@ -70,7 +70,7 @@ int main(int argc, const char **argv) } dout(0) << "starting thread" << dendl; - foo.create(); + foo.create("foo"); dout(0) << "starting op" << dendl; fs->apply_transaction(&osr, t); diff --git a/src/test/test_workqueue.cc b/src/test/test_workqueue.cc index 602a0ec1eae..c7ff4335472 100644 --- a/src/test/test_workqueue.cc +++ b/src/test/test_workqueue.cc @@ -8,7 +8,7 @@ TEST(WorkQueue, StartStop) { - ThreadPool tp(g_ceph_context, "foo", 10, ""); + ThreadPool tp(g_ceph_context, "foo", "tp_foo", 10, ""); tp.start(); tp.pause(); @@ -21,7 +21,7 @@ TEST(WorkQueue, StartStop) TEST(WorkQueue, Resize) { - ThreadPool tp(g_ceph_context, "bar", 2, "osd_op_threads"); + ThreadPool tp(g_ceph_context, "bar", "tp_bar", 2, "osd_op_threads"); tp.start(); diff --git a/src/tools/cephfs/MDSUtility.cc b/src/tools/cephfs/MDSUtility.cc index 708b57c8559..d335d92fda0 100644 --- a/src/tools/cephfs/MDSUtility.cc +++ b/src/tools/cephfs/MDSUtility.cc @@ -22,7 +22,7 @@ MDSUtility::MDSUtility() : objecter(NULL), lock("MDSUtility::lock"), timer(g_ceph_context, lock), - finisher(g_ceph_context, "MDSUtility"), + finisher(g_ceph_context, "MDSUtility", "fn_mds_utility"), waiting_for_mds_map(NULL) { monc = new MonClient(g_ceph_context); diff --git a/src/tools/rbd_nbd/rbd-nbd.cc b/src/tools/rbd_nbd/rbd-nbd.cc index b86bcebdeee..a6363d4a62c 100644 --- a/src/tools/rbd_nbd/rbd-nbd.cc +++ b/src/tools/rbd_nbd/rbd-nbd.cc @@ -262,8 +262,8 @@ public: if (!started) { started = true; - reader_thread.create(); - writer_thread.create(); + reader_thread.create("rbd_reader"); + writer_thread.create("rbd_writer"); } } |