Browse Source

kernel: sched: Fix meta-IRQ preemption tracking for the idle thread

When the PM subsystem is enabled, the idle thread locks the scheduler for
the duration the system is suspended. If a meta-IRQ preempts the idle
thread in this state, the idle thread is tracked in `metairq_preempted`.
However, when returning from the preemption, the idle thread is not removed
from `metairq_preempted`, unlike all the other threads. As a result, the
scheduler keeps running the idle thread even if there are higher priority
threads ready to run.

This change treats the idle thread the same way as all other threads when
returning from a meta-IRQ preemption.

Fixes #64705

Signed-off-by: Kalle Kietäväinen <kalle.kietavainen@silabs.com>
pull/84606/head
Kalle Kietäväinen 6 months ago committed by Benjamin Cabé
parent
commit
a2eb78c03b
  1. 2
      kernel/sched.c

2
kernel/sched.c

@ -273,7 +273,7 @@ static void update_metairq_preempt(struct k_thread *thread) @@ -273,7 +273,7 @@ static void update_metairq_preempt(struct k_thread *thread)
!thread_is_preemptible(_current)) {
/* Record new preemption */
_current_cpu->metairq_preempted = _current;
} else if (!thread_is_metairq(thread) && !z_is_idle_thread_object(thread)) {
} else if (!thread_is_metairq(thread)) {
/* Returning from existing preemption */
_current_cpu->metairq_preempted = NULL;
}

Loading…
Cancel
Save