From 120a6c1c2a3e15ff10652e4ecac3252ac388e1bf Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Fri, 28 Jan 2022 14:58:28 +0000 Subject: [PATCH] nvmf: do not encode core number into thread name The nvmf subsystem cannot control which core its threads get scheduled on. Even in the normal, default case, the app thread has already been scheduled on the first core, so the first nvmf thread will get scheduled on the second core, etc. So instead, always use a 0-based index for the names of the nvmf threads. Reported-by: Jacek Kalwas Signed-off-by: Jim Harris Change-Id: I8a0f161860b985f36920845de28b39dbae9fdca5 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11351 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Aleksey Marchuk Reviewed-by: Paul Luse Reviewed-by: Tomasz Zawadzki Reviewed-by: Jacek Kalwas --- module/event/subsystems/nvmf/nvmf_tgt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/event/subsystems/nvmf/nvmf_tgt.c b/module/event/subsystems/nvmf/nvmf_tgt.c index b6573a237..2c60f7c0f 100644 --- a/module/event/subsystems/nvmf/nvmf_tgt.c +++ b/module/event/subsystems/nvmf/nvmf_tgt.c @@ -209,18 +209,18 @@ nvmf_tgt_create_poll_group(void *ctx) static void nvmf_tgt_create_poll_groups(void) { - uint32_t i; + uint32_t cpu, count = 0; char thread_name[32]; struct spdk_thread *thread; g_tgt_init_thread = spdk_get_thread(); assert(g_tgt_init_thread != NULL); - SPDK_ENV_FOREACH_CORE(i) { - if (g_poll_groups_mask && !spdk_cpuset_get_cpu(g_poll_groups_mask, i)) { + SPDK_ENV_FOREACH_CORE(cpu) { + if (g_poll_groups_mask && !spdk_cpuset_get_cpu(g_poll_groups_mask, cpu)) { continue; } - snprintf(thread_name, sizeof(thread_name), "nvmf_tgt_poll_group_%u", i); + snprintf(thread_name, sizeof(thread_name), "nvmf_tgt_poll_group_%u", count++); thread = spdk_thread_create(thread_name, g_poll_groups_mask); assert(thread != NULL);