From 9077b924fac1d242882a713116dc04c7b7dad1e5 Mon Sep 17 00:00:00 2001 From: Peter Mitsis Date: Fri, 1 Mar 2024 14:44:26 -0500 Subject: [PATCH] kernel: Move flag_ipi() into z_set_prio() Moves a call to flag_ipi() from z_thread_priority_set() into z_set_prio(). This allows for an IPI to be done for a thread that had its priority bumped due to the handling of priority inheritance from a mutex. Incidentally, all calls to flag_ipi() are now performed with sched_spinlock being locked. Signed-off-by: Peter Mitsis --- kernel/sched.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched.c b/kernel/sched.c index 15d9b1d61648788..905be3ac66e6aa9 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -1002,6 +1002,8 @@ bool z_set_prio(struct k_thread *thread, int prio) } else { thread->base.prio = prio; } + + flag_ipi(); update_cache(1); } else { thread->base.prio = prio; @@ -1017,8 +1019,6 @@ void z_thread_priority_set(struct k_thread *thread, int prio) { bool need_sched = z_set_prio(thread, prio); - flag_ipi(); - if (need_sched && _current->base.sched_locked == 0U) { z_reschedule_unlocked(); }