Skip to content

Commit a2eb78c

Browse files
kietavainenkartben
authored andcommitted
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 <[email protected]>
1 parent 2ca64a3 commit a2eb78c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/sched.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ static void update_metairq_preempt(struct k_thread *thread)
273273
!thread_is_preemptible(_current)) {
274274
/* Record new preemption */
275275
_current_cpu->metairq_preempted = _current;
276-
} else if (!thread_is_metairq(thread) && !z_is_idle_thread_object(thread)) {
276+
} else if (!thread_is_metairq(thread)) {
277277
/* Returning from existing preemption */
278278
_current_cpu->metairq_preempted = NULL;
279279
}

0 commit comments

Comments
 (0)