From a3c7152f92bbcb67a4404329ac9cd4e4eb85f795 Mon Sep 17 00:00:00 2001 From: Peter Mitsis Date: Fri, 26 Apr 2024 10:32:47 -0400 Subject: [PATCH] kernel: Update thread cpu in z_get_next_switch_handle() Updates z_get_next_switch_handle() to set the new thread's base.cpu value as it is done in do_swap(). This helps to ensure that the last CPU on which the thread executed remains current. Signed-off-by: Peter Mitsis --- kernel/sched.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/sched.c b/kernel/sched.c index 432918485d..866a517755 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -898,6 +898,7 @@ void *z_get_next_switch_handle(void *interrupted) arch_cohere_stacks(old_thread, interrupted, new_thread); _current_cpu->swap_ok = 0; + new_thread->base.cpu = arch_curr_cpu()->id; set_current(new_thread); #ifdef CONFIG_TIMESLICING