Skip to content

Commit

Permalink
kernel: Move flag_ipi() into z_set_prio()
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
peter-mitsis committed Mar 4, 2024
1 parent 4c8fafd commit 9077b92
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
Expand Down

0 comments on commit 9077b92

Please sign in to comment.