lib/event: remove new_lcore from lw_thread
There is no need to keep new_lcore field. lcore value is enough to determine the target core. Meanwhile _threads_reschedule() can see if the target core matches the one from core_info. Removed _spdk_lw_thread_set_core() since it did not serve much purpose. Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: I82c7cfebf1107b4a55b2af9b891052084a788907 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8046 Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
18667806ca
commit
902c9e4de7
@ -64,7 +64,6 @@ struct spdk_lw_thread {
|
||||
TAILQ_ENTRY(spdk_lw_thread) link;
|
||||
uint64_t tsc_start;
|
||||
uint32_t lcore;
|
||||
uint32_t new_lcore;
|
||||
bool resched;
|
||||
/* stats over a lifetime of a thread */
|
||||
struct spdk_thread_stats total_stats;
|
||||
|
@ -72,9 +72,8 @@ static void
|
||||
balance(struct spdk_scheduler_core_info *cores, int core_count, struct spdk_governor *governor)
|
||||
{
|
||||
struct spdk_scheduler_core_info *core;
|
||||
struct spdk_lw_thread *thread;
|
||||
struct spdk_governor_capabilities capabilities;
|
||||
uint32_t i, j;
|
||||
uint32_t i;
|
||||
int rc;
|
||||
bool turbo_available = false;
|
||||
|
||||
@ -82,13 +81,6 @@ balance(struct spdk_scheduler_core_info *cores, int core_count, struct spdk_gove
|
||||
SPDK_ENV_FOREACH_CORE(i) {
|
||||
core = &cores[i];
|
||||
|
||||
for (j = 0; j < core->threads_count; j++) {
|
||||
thread = core->threads[j];
|
||||
|
||||
/* do not change thread lcore */
|
||||
thread->new_lcore = thread->lcore;
|
||||
}
|
||||
|
||||
rc = governor->get_core_capabilities(core->lcore, &capabilities);
|
||||
if (rc < 0) {
|
||||
SPDK_ERRLOG("failed to get capabilities for core: %u\n", core->lcore);
|
||||
|
@ -698,8 +698,8 @@ _threads_reschedule(struct spdk_scheduler_core_info *cores_info)
|
||||
core = &cores_info[i];
|
||||
for (j = 0; j < core->threads_count; j++) {
|
||||
lw_thread = core->threads[j];
|
||||
if (lw_thread->lcore != lw_thread->new_lcore) {
|
||||
_spdk_lw_thread_set_core(lw_thread, lw_thread->new_lcore);
|
||||
if (lw_thread->lcore != i) {
|
||||
lw_thread->resched = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1276,7 +1276,9 @@ _reactor_request_thread_reschedule(struct spdk_thread *thread)
|
||||
|
||||
lw_thread = spdk_thread_get_ctx(thread);
|
||||
|
||||
_spdk_lw_thread_set_core(lw_thread, SPDK_ENV_LCORE_ID_ANY);
|
||||
assert(lw_thread != NULL);
|
||||
lw_thread->resched = true;
|
||||
lw_thread->lcore = SPDK_ENV_LCORE_ID_ANY;
|
||||
|
||||
current_core = spdk_env_get_current_core();
|
||||
reactor = spdk_reactor_get(current_core);
|
||||
@ -1483,14 +1485,6 @@ reactor_interrupt_fini(struct spdk_reactor *reactor)
|
||||
reactor->fgrp = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
_spdk_lw_thread_set_core(struct spdk_lw_thread *thread, uint32_t lcore)
|
||||
{
|
||||
assert(thread != NULL);
|
||||
thread->lcore = lcore;
|
||||
thread->resched = true;
|
||||
}
|
||||
|
||||
static int
|
||||
_governor_get_capabilities(uint32_t lcore_id, struct spdk_governor_capabilities *capabilities)
|
||||
{
|
||||
|
@ -154,7 +154,6 @@ balance(struct spdk_scheduler_core_info *cores_info, int cores_count,
|
||||
|
||||
for (j = 0; j < core->threads_count; j++) {
|
||||
lw_thread = core->threads[j];
|
||||
lw_thread->new_lcore = lw_thread->lcore;
|
||||
thread = spdk_thread_get_from_ctx(lw_thread);
|
||||
cpumask = spdk_thread_get_cpumask(thread);
|
||||
|
||||
@ -173,7 +172,7 @@ balance(struct spdk_scheduler_core_info *cores_info, int cores_count,
|
||||
}
|
||||
|
||||
if (spdk_cpuset_get_cpu(cpumask, target_lcore)) {
|
||||
lw_thread->new_lcore = target_lcore;
|
||||
lw_thread->lcore = target_lcore;
|
||||
cores_info[target_lcore].pending_threads_count++;
|
||||
core->pending_threads_count--;
|
||||
|
||||
@ -188,7 +187,7 @@ balance(struct spdk_scheduler_core_info *cores_info, int cores_count,
|
||||
}
|
||||
} else if (i != g_main_lcore && load < SCHEDULER_LOAD_LIMIT) {
|
||||
/* This thread is idle but not on the main core, so we need to move it to the main core */
|
||||
lw_thread->new_lcore = g_main_lcore;
|
||||
lw_thread->lcore = g_main_lcore;
|
||||
cores_info[g_main_lcore].pending_threads_count++;
|
||||
core->pending_threads_count--;
|
||||
|
||||
@ -202,7 +201,7 @@ balance(struct spdk_scheduler_core_info *cores_info, int cores_count,
|
||||
target_lcore = _get_next_target_core();
|
||||
|
||||
if (spdk_cpuset_get_cpu(cpumask, target_lcore)) {
|
||||
lw_thread->new_lcore = target_lcore;
|
||||
lw_thread->lcore = target_lcore;
|
||||
cores_info[target_lcore].pending_threads_count++;
|
||||
core->pending_threads_count--;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user