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: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Ib521ac0d8959ec8062322ff7b2ad587d85ccada5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5638
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
This commit is contained in:
Maciej Szwed 2020-12-16 12:59:43 +01:00 committed by Tomasz Zawadzki
parent ce23de932d
commit ad15f44116
2 changed files with 8 additions and 0 deletions

View File

@ -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;

View File

@ -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);