851d14afc8
The scheduler has historically had an API where an application can inform the kernel that it will never create a thread that can be preempted, and the kernel and architecture layer would use that as an optimization hint to eliminate some code paths. Those optimizations have dwindled to almost nothing at this point, and they're now objectively a smaller impact than the special casing that was required to handle the idle thread (which, obviously, must always be preemptible). Fix this by eliminating the idea of "cooperative only" and ensuring that there will always be at least one preemptible priority with value >=0. CONFIG_NUM_PREEMPT_PRIORITIES now specifies the number of user-accessible priorities other than the idle thread. The only remaining workaround is that some older architectures (and also SPARC) use the CONFIG_PREEMPT_ENABLED=n state as a hint to skip thread switching on interrupt exit. So detect exactly those platforms and implement a minimal workaround in the idle loop (basically "just call swap()") instead, with a big explanation. Note that this also fixes a bug in one of the philosophers samples, where it would ask for 6 cooperative priorities but then use values -7 through -2. It was assuming the kernel would magically create a cooperative priority for its idle thread, which wasn't correct even before. Fixes #34584 Signed-off-by: Andy Ross <andrew.j.ross@intel.com> |
||
---|---|---|
.. | ||
application_development | ||
arch | ||
basic | ||
bluetooth | ||
boards | ||
drivers | ||
hello_world | ||
kernel | ||
modules | ||
net | ||
philosophers | ||
posix | ||
sensor | ||
shields | ||
subsys | ||
synchronization | ||
tfm_integration | ||
userspace | ||
classic.rst | ||
index.rst |