From 286a43f5124a45d227e2ec1fe661b4a70e24765b Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Tue, 25 May 2021 05:36:15 -0400 Subject: [PATCH] scheduler_dynamic: move busy_threads_present At this time only main lcore frequency is changed, depending on its load either up or down. Exception is when at least a single busy thread is present on non-g_main_lcore. Then the main lcore frequency is set to the maximum possible. This patch moves when that is determined, from 'moving' logic to one that sets reactors to interrupt mode. If at least one thread is present on non-g_main_lcore, it has to be busy. Otherwise it would be placed on main lcore. Signed-off-by: Tomasz Zawadzki Change-Id: I2900598afe53fb609e1f06a60d5245f74511e1c3 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8050 Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto Reviewed-by: Konrad Sztyber Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot --- lib/event/scheduler_dynamic.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/event/scheduler_dynamic.c b/lib/event/scheduler_dynamic.c index 368f9bfd96..e8a82d1404 100644 --- a/lib/event/scheduler_dynamic.c +++ b/lib/event/scheduler_dynamic.c @@ -188,7 +188,6 @@ balance(struct spdk_scheduler_core_info *cores_info, int cores_count, g_cores[i].thread_count--; if (target_lcore != g_main_lcore) { - busy_threads_present = true; main_core->idle += spdk_min(UINT64_MAX - main_core->idle, thread_busy); main_core->busy -= spdk_min(main_core->busy, thread_busy); } @@ -226,8 +225,6 @@ balance(struct spdk_scheduler_core_info *cores_info, int cores_count, } } } - - busy_threads_present = true; } } } @@ -243,6 +240,11 @@ balance(struct spdk_scheduler_core_info *cores_info, int cores_count, core->interrupt_mode = true; } else if (g_cores[i].thread_count != 0) { core->interrupt_mode = false; + if (i != g_main_lcore) { + /* If a thread is present on non g_main_lcore, + * it has to be busy. */ + busy_threads_present = true; + } } }