kernel/timeout: Fix timeslicing edge case in SMP
The timeout code has an optimization where it refuses to send a new timeout to the driver unless it is sooner than one already scheduled. This won't work on SMP, though, because the timeout value when timeslicing is enabled depends on the current thread, and on SMP the decision as to the next thread will not be made until later (when we swap, or exit an interrupt). Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
parent
11bd67db53
commit
6a153efc1b
1 changed files with 5 additions and 1 deletions
|
@ -168,8 +168,12 @@ void z_set_timeout_expiry(s32_t ticks, bool idle)
|
|||
* one is about to expire: drivers have internal logic
|
||||
* that will bump the timeout to the "next" tick if
|
||||
* it's not considered to be settable as directed.
|
||||
* SMP can't use this optimization though: we don't
|
||||
* know when context switches happen until interrupt
|
||||
* exit and so can't get the timeslicing clamp folded
|
||||
* in.
|
||||
*/
|
||||
if (sooner && !imminent) {
|
||||
if (!imminent && (sooner || IS_ENABLED(CONFIG_SMP))) {
|
||||
z_clock_set_timeout(ticks, idle);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue