Skip to content

Commit a3c7152

Browse files
peter-mitsisfabiobaltieri
authored andcommitted
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 <[email protected]>
1 parent 4363a78 commit a3c7152

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

kernel/sched.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,7 @@ void *z_get_next_switch_handle(void *interrupted)
898898
arch_cohere_stacks(old_thread, interrupted, new_thread);
899899

900900
_current_cpu->swap_ok = 0;
901+
new_thread->base.cpu = arch_curr_cpu()->id;
901902
set_current(new_thread);
902903

903904
#ifdef CONFIG_TIMESLICING

0 commit comments

Comments
 (0)