Commit ad15f441 authored by Maciej Szwed's avatar Maciej Szwed Committed by Tomasz Zawadzki
Browse files

scheduler: Don't use main core for new thread if it is too busy



We don't want to make main core 100% busy, so don't
move thread to it if thread busy time is higher than
main core idle time.

Signed-off-by: default avatarMaciej Szwed <maciej.szwed@intel.com>
Change-Id: Ib521ac0d8959ec8062322ff7b2ad587d85ccada5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5638


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
parent ce23de93
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -161,6 +161,11 @@ balance(struct spdk_scheduler_core_info *cores_info, int cores_count,
					target_lcore = g_next_lcore;
					g_next_lcore = spdk_env_get_next_core(g_next_lcore);

					/* Do not use main core if it is too busy for new thread */
					if (target_lcore == g_main_lcore && thread_busy > main_core_idle) {
						continue;
					}

					if (spdk_cpuset_get_cpu(cpumask, target_lcore)) {
						lw_thread->new_lcore = target_lcore;

+3 −0
Original line number Diff line number Diff line
@@ -560,6 +560,9 @@ test_scheduler(void)
		spdk_poller_unregister(&busy);
	}

	reactor->busy_tsc = 0;
	reactor->idle_tsc = UINT32_MAX;

	/* Run scheduler again, this time all threads are busy */
	_reactors_scheduler_gather_metrics(NULL, NULL);