schedulers: Switch to interrupt mode if core is unused
Save CPU resources by switching reactors w/o any threads to interrupt mode. Signed-off-by: Maciej Szwed <maciej.szwed@intel.com> Change-Id: Ibd1c1d50d1f6c6d7ed226d585e14999c2fd04621 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5456 Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
6859a49a98
commit
e742a41456
@ -109,6 +109,7 @@ static void
|
|||||||
balance(struct spdk_scheduler_core_info *cores_info, int cores_count,
|
balance(struct spdk_scheduler_core_info *cores_info, int cores_count,
|
||||||
struct spdk_governor *governor)
|
struct spdk_governor *governor)
|
||||||
{
|
{
|
||||||
|
struct spdk_reactor *reactor;
|
||||||
struct spdk_lw_thread *lw_thread;
|
struct spdk_lw_thread *lw_thread;
|
||||||
struct spdk_thread *thread;
|
struct spdk_thread *thread;
|
||||||
struct spdk_scheduler_core_info *core;
|
struct spdk_scheduler_core_info *core;
|
||||||
@ -202,6 +203,19 @@ balance(struct spdk_scheduler_core_info *cores_info, int cores_count,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Switch unused cores to interrupt mode and switch cores to polled mode
|
||||||
|
* if they will be used after rebalancing */
|
||||||
|
SPDK_ENV_FOREACH_CORE(i) {
|
||||||
|
reactor = spdk_reactor_get(i);
|
||||||
|
core = &cores_info[i];
|
||||||
|
/* We can switch mode only if reactor already does not have any threads */
|
||||||
|
if (core->pending_threads_count == 0 && TAILQ_EMPTY(&reactor->threads)) {
|
||||||
|
core->interrupt_mode = true;
|
||||||
|
} else if (core->pending_threads_count != 0) {
|
||||||
|
core->interrupt_mode = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!g_core_mngmnt_available) {
|
if (!g_core_mngmnt_available) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user