diff --git a/lib/event/reactor.c b/lib/event/reactor.c index ce575deafd..e6d8179938 100644 --- a/lib/event/reactor.c +++ b/lib/event/reactor.c @@ -679,8 +679,6 @@ _init_thread_stats(struct spdk_reactor *reactor, struct spdk_lw_thread *lw_threa /* Read total_stats before updating it to calculate stats during the last scheduling period. */ prev_total_stats = lw_thread->total_stats; - lw_thread->lcore = reactor->lcore; - spdk_set_thread(thread); spdk_thread_get_stats(&lw_thread->total_stats); spdk_set_thread(NULL); @@ -1155,6 +1153,8 @@ _schedule_thread(void *arg1, void *arg2) spdk_thread_get_stats(&lw_thread->total_stats); spdk_set_thread(NULL); + lw_thread->lcore = current_core; + TAILQ_INSERT_TAIL(&reactor->threads, lw_thread, link); reactor->thread_count++;