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>
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;
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;
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) {