Commit f8a961f5 authored by Tomasz Zawadzki's avatar Tomasz Zawadzki
Browse files

scheduler_dynamic: prioritize g_main_lcore during _find_optimal_core



_find_optimal_core was always consolidating idle threads to g_main_lcore.
Meanwhile for active threads lower lcore id were prioritized over the
higher ones.

So long as g_main_lcore can fit the active thread, it should be prioritized
over any other. Regardless of the lcore id.

Fix #2080

Signed-off-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I30b3a7353bcf243d4362b4db9dde5446c435d675
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9243


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 45dddbc8
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -232,12 +232,14 @@ _find_optimal_core(struct spdk_scheduler_thread_info *thread_info)
		if (!_can_core_fit_thread(thread_info, i) || i == current_lcore) {
			continue;
		}

		if (i < current_lcore) {
		if (i == g_main_lcore) {
			/* First consider g_main_lcore, consolidate threads on main lcore if possible. */
			return i;
		} else if (i < current_lcore && current_lcore != g_main_lcore) {
			/* Lower core id was found, move to consolidate threads on lowest core ids. */
			return i;
		} else if (core_at_limit) {
			/* When core is over the limit, even higher core ids are better than current one. */
			/* When core is over the limit, any core id is better than current one. */
			return i;
		}
	}