Skip to content
Browse files

kernel: sched: Do not force preempt when k_sched_unlock()

The scheduler lock is a nestable lock.  Unlocking a nested,
still-having, lock shouldn't preempt the current thread.

	k_sched_unlock();  /* <--- this shouldn't be a scheduling point */
	k_sched_unlock();  /* <--- this is a scheduling point */

This commit changes the preempt_ok argument from 1 to 0.  This let
should_preempt() check whether it should preempt at the point or not.

This fixes #17869.

Signed-off-by: Yasushi SHOJI <>
  • Loading branch information...
yashi authored and carlescufi committed Jul 31, 2019
1 parent 612a608 commit 20d072465d452aff52181041344e435c5a042d75
Showing with 1 addition and 1 deletion.
  1. +1 −1 kernel/sched.c
@@ -555,7 +555,7 @@ void k_sched_unlock(void)

LOCKED(&sched_spinlock) {

K_DEBUG("scheduler unlocked (%p:%d)\n",

0 comments on commit 20d0724

Please sign in to comment.
You can’t perform that action at this time.