kernel: fix short time-slice reset
The kernel tracks time slice usage with the _time_slice_elapsed global. Every time the timer interrupt goes off and the timer driver calls _nano_sys_clock_tick_announce() with the elapsed time, this is added to _time_slice_elapsed. If it exceeds the total time slice, the thread is moved to the back of the queue for that priority level and _time_slice_elapsed is reset to zero. In a non-tickless kernel, this is the only time _time_slice_elapsed is reset. If a thread uses up a partial time slice, and then cooperatively switches to another thread, the next thread will inherit the remaining time slice, causing it not to be able to run as long as it ought to. There does exist code to properly reset the elapsed count, but it was only compiled in a tickless kernel. Now it is built any time CONFIG_TIMESLICING is enabled. Issue: ZEP-2107 Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
106bf1c09a
commit
3989de7e3b
5 changed files with 10 additions and 20 deletions
|
@ -24,7 +24,7 @@ _ASM_FILE_PROLOGUE
|
|||
GTEXT(_ExcExit)
|
||||
GTEXT(_IntExit)
|
||||
GDATA(_kernel)
|
||||
#ifdef CONFIG_TICKLESS_KERNEL
|
||||
#ifdef CONFIG_TIMESLICING
|
||||
GTEXT(_update_time_slice_before_swap)
|
||||
#endif
|
||||
|
||||
|
@ -58,7 +58,7 @@ SECTION_SUBSEC_FUNC(TEXT, _HandlerModeExit, _IntExit)
|
|||
|
||||
/* _IntExit falls through to _ExcExit (they are aliases of each other) */
|
||||
|
||||
#ifdef CONFIG_TICKLESS_KERNEL
|
||||
#ifdef CONFIG_TIMESLICING
|
||||
push {lr}
|
||||
bl _update_time_slice_before_swap
|
||||
#if defined(CONFIG_ARMV6_M)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue