]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async: execute on core specified by core_id not its index 20659/head
authorKefu Chai <kchai@redhat.com>
Thu, 1 Mar 2018 07:19:36 +0000 (15:19 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 1 Mar 2018 08:06:14 +0000 (16:06 +0800)
Reported-by: shangfufei <shangfufei@inspur.com>
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/msg/async/dpdk/DPDKStack.cc

index fce05098007f7d725cec8a5f50425be007e54453..9772d0f08b946ef5a077bd1c79fe2ba9ce821557 100644 (file)
@@ -250,8 +250,14 @@ void DPDKStack::spawn_worker(unsigned i, std::function<void ()> &&func)
   // if dpdk::eal::init already called by NVMEDevice, we will select 1..n
   // cores
   assert(rte_lcore_count() >= i + 1);
+  unsigned core_id;
+  RTE_LCORE_FOREACH_SLAVE(core_id) {
+    if (i-- == 0) {
+      break;
+    }
+  }
   dpdk::eal::execute_on_master([&]() {
-    r = rte_eal_remote_launch(dpdk_thread_adaptor, static_cast<void*>(&funcs[i]), i+1);
+    r = rte_eal_remote_launch(dpdk_thread_adaptor, static_cast<void*>(&funcs[i]), core_id);
     if (r < 0) {
       lderr(cct) << __func__ << " remote launch failed, r=" << r << dendl;
       ceph_abort();