event/scheduler_dynamic: remove g_core_mngmnt_available

There is no need to track if governor was enabled during
initialization of the scheduler dynamic.
Instead _spdk_governor_get() can be used to determine that.

While here set the default g_governor to NULL.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ibdfde3d2714dd0b6d629f19f0d246b4fc3c9d214
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9325
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Tomasz Zawadzki 2021-08-27 04:42:19 -04:00
parent ece9471659
commit a09bf113a8
2 changed files with 6 additions and 10 deletions

View File

@ -76,7 +76,7 @@ static struct spdk_scheduler_core_info *g_core_infos = NULL;
TAILQ_HEAD(, spdk_governor) g_governor_list
= TAILQ_HEAD_INITIALIZER(g_governor_list);
static struct spdk_governor *g_governor;
static struct spdk_governor *g_governor = NULL;
static int reactor_interrupt_init(struct spdk_reactor *reactor);
static void reactor_interrupt_fini(struct spdk_reactor *reactor);

View File

@ -41,7 +41,6 @@
#include "spdk_internal/event.h"
static uint32_t g_main_lcore;
static bool g_core_mngmnt_available;
struct core_stats {
uint64_t busy;
@ -223,12 +222,11 @@ _find_optimal_core(struct spdk_scheduler_thread_info *thread_info)
static int
init(void)
{
int rc;
g_main_lcore = spdk_env_get_current_core();
rc = _spdk_governor_set("dpdk_governor");
g_core_mngmnt_available = !rc;
if (_spdk_governor_set("dpdk_governor") != 0) {
SPDK_NOTICELOG("Unable to initialize dpdk governor\n");
}
g_cores = calloc(spdk_env_get_last_core() + 1, sizeof(struct core_stats));
if (g_cores == NULL) {
@ -314,13 +312,11 @@ balance(struct spdk_scheduler_core_info *cores_info, uint32_t cores_count)
}
}
if (!g_core_mngmnt_available) {
governor = _spdk_governor_get();
if (governor == NULL) {
return;
}
governor = _spdk_governor_get();
assert(governor != NULL);
/* Change main core frequency if needed */
if (busy_threads_present) {
rc = governor->set_core_freq_max(g_main_lcore);