scheduler_dynamic: fix busy tsc accounting
For the src thread, add the busy_tsc of the thread we are moving to the idle_tsc of the current core. This is consistent with how are accounting for the cycles in the target core too. We will disable the load_balancing.sh script for now. We will reenable it later in this patch set once a few other changes are made, along with some updates to the load_balancing.sh script based on the changes made in this patch set. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I8af82610804e97dabf62ccd90f75a0e6e37d276f Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9550 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
62b273d7cf
commit
f1acee8f83
@ -98,7 +98,6 @@ _move_thread(struct spdk_scheduler_thread_info *thread_info, uint32_t dst_core)
|
||||
struct core_stats *dst = &g_cores[dst_core];
|
||||
struct core_stats *src = &g_cores[thread_info->lcore];
|
||||
uint64_t busy_tsc = thread_info->current_stats.busy_tsc;
|
||||
uint64_t idle_tsc = thread_info->current_stats.idle_tsc;
|
||||
|
||||
if (src == dst) {
|
||||
/* Don't modify stats if thread is already on that core. */
|
||||
@ -109,10 +108,11 @@ _move_thread(struct spdk_scheduler_thread_info *thread_info, uint32_t dst_core)
|
||||
dst->idle -= spdk_min(dst->idle, busy_tsc);
|
||||
dst->thread_count++;
|
||||
|
||||
/* Decrease busy/idle from core as if thread was not present on it.
|
||||
* Core load will reflect the sum of all other threads on it. */
|
||||
/* Adjust busy/idle from core as if thread was not present on it.
|
||||
* Core load will reflect the sum of all remaining threads on it. */
|
||||
src->busy -= spdk_min(src->busy, busy_tsc);
|
||||
src->idle -= spdk_min(src->idle, idle_tsc);
|
||||
src->idle += spdk_min(UINT64_MAX - src->idle, busy_tsc);
|
||||
|
||||
assert(src->thread_count > 0);
|
||||
src->thread_count--;
|
||||
|
||||
|
@ -77,3 +77,8 @@ vhost_scsi_fs_integrity
|
||||
vhost_scsi_integrity
|
||||
vhost_scsi_nightly
|
||||
vhost_scsi_cores_2ctrl
|
||||
|
||||
# Temporarily disabled as part of dynamic scheduler patch set
|
||||
busy
|
||||
balanced
|
||||
core_load
|
||||
|
@ -9,6 +9,6 @@ source "$testdir/isolate_cores.sh"
|
||||
"$rootdir/scripts/setup.sh"
|
||||
|
||||
run_test "idle" "$testdir/idle.sh"
|
||||
run_test "load_balancing" "$testdir/load_balancing.sh"
|
||||
#run_test "load_balancing" "$testdir/load_balancing.sh"
|
||||
run_test "dpdk_governor" "$testdir/governor.sh"
|
||||
run_test "interrupt_mode" "$testdir/interrupt.sh"
|
||||
|
@ -718,7 +718,7 @@ test_scheduler(void)
|
||||
_run_events_till_completion(3);
|
||||
MOCK_SET(spdk_env_get_current_core, 0);
|
||||
|
||||
/* Threads were busy, so they should be distributed evenly across cores */
|
||||
/* Threads were busy, 2 will stay on core 0, 1 will move to core 1 */
|
||||
for (i = 0; i < 3; i++) {
|
||||
MOCK_SET(spdk_env_get_current_core, i);
|
||||
reactor = spdk_reactor_get(i);
|
||||
@ -729,7 +729,11 @@ test_scheduler(void)
|
||||
for (i = 0; i < 3; i++) {
|
||||
reactor = spdk_reactor_get(i);
|
||||
CU_ASSERT(reactor != NULL);
|
||||
CU_ASSERT(!TAILQ_EMPTY(&reactor->threads));
|
||||
if (i == 2) {
|
||||
CU_ASSERT(TAILQ_EMPTY(&reactor->threads));
|
||||
} else {
|
||||
CU_ASSERT(!TAILQ_EMPTY(&reactor->threads));
|
||||
}
|
||||
}
|
||||
|
||||
g_reactor_state = SPDK_REACTOR_STATE_INITIALIZED;
|
||||
|
Loading…
Reference in New Issue
Block a user