kernel/sched: Fix preemption logic
The should_preempt() code was catching some of the "unrunnable" cases but not all of them, opening the possibility of failing to preempt a just-pended thread and thus waking it up synchronously. There are reports of this causing spin loops over k_poll() in the network stack work queues (see #8049). Note that the previous _is_dummy() call is folded into (the somewhat verbosely named) _is_thread_prevented_from_running(), and that the order of tests has been changed/optimized to hopefully catch common cases earlier. Suggested-by:Michael Scott <michael@opensourcefoundries.com> Signed-off-by:
Andy Ross <andrew.j.ross@intel.com>
Loading
Please sign in to comment