]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async: refactory rename_thread for DPDKStack
authorChunsong Feng <fengchunsong@huawei.com>
Fri, 10 Dec 2021 10:18:36 +0000 (10:18 +0000)
committerChunsong Feng <fengchunsong@huawei.com>
Mon, 27 Dec 2021 13:04:56 +0000 (13:04 +0000)
The thread_name of the DPDK thread has been set during DPDK initialization.

Signed-off-by: Chunsong Feng <fengchunsong@huawei.com>
Reviewed-by: luo rixin <luorixin@huawei.com>
Reviewed-by: Han Fengzhe <hanfengzhe@hisilicon.com>
src/msg/async/Stack.cc
src/msg/async/Stack.h
src/msg/async/dpdk/DPDKStack.h

index 55c25f60f5e45c1fd6e4a053620e7164b2e0694e..94a1bba53637009a284fc508aa9f7d206a54fdf0 100644 (file)
@@ -37,9 +37,7 @@
 std::function<void ()> NetworkStack::add_thread(Worker* w)
 {
   return [this, w]() {
-      char tp_name[16];
-      sprintf(tp_name, "msgr-worker-%u", w->id);
-      ceph_pthread_setname(pthread_self(), tp_name);
+      rename_thread(w->id);
       const unsigned EventMaxWaitUs = 30000000;
       w->center.set_owner();
       ldout(cct, 10) << __func__ << " starting" << dendl;
index 3ce87975bf5955dc32a38e45706c9bfbd164a54b..97201787c73cbdacdfa329d79feb3a8f9cb30441 100644 (file)
@@ -299,6 +299,12 @@ class NetworkStack {
   std::function<void ()> add_thread(Worker* w);
 
   virtual Worker* create_worker(CephContext *c, unsigned i) = 0;
+  virtual void rename_thread(unsigned id) {
+    static constexpr int TASK_COMM_LEN = 16;
+    char tp_name[TASK_COMM_LEN];
+    sprintf(tp_name, "msgr-worker-%u", id);
+    ceph_pthread_setname(pthread_self(), tp_name);
+  }
 
  protected:
   CephContext *cct;
index e46bb6f51039e92677ffe44c8f0abb34f6ffea59..f05873572a332c4dd2571f2a6c46fdc319e98d81 100644 (file)
@@ -254,6 +254,7 @@ class DPDKStack : public NetworkStack {
   virtual Worker* create_worker(CephContext *c, unsigned worker_id) override {
     return new DPDKWorker(c, worker_id);
   }
+  virtual void rename_thread(unsigned id) override {}
 
  public:
   explicit DPDKStack(CephContext *cct): NetworkStack(cct), eal(cct) {