kernel: sched: Use ticks as time unit in time slicing.
The time slicing settings was kept in milliseconds while all related operations was based on ticks. Continuous back and forth conversion between ticks and milliseconds introduced an accumulating error due to rounding in _ms_to_ticks() and __ticks_to_ms(). As result configured time slice duration was not achieved. This commit removes excessive ticks <-> ms conversion by using ticks as time unit for all operations related to time slicing. Also, it fixes #8896 as well as #8897. Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
This commit is contained in:
parent
e670135fdc
commit
2a26576b03
1 changed files with 2 additions and 3 deletions
|
@ -641,10 +641,9 @@ void _update_time_slice_before_swap(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
u32_t remaining = _get_remaining_program_time();
|
u32_t remaining = _get_remaining_program_time();
|
||||||
u32_t time_slice_ticks = _ms_to_ticks(_time_slice_duration);
|
|
||||||
|
|
||||||
if (!remaining || (_time_slice_ticks < remaining)) {
|
if (!remaining || (_time_slice_duration < remaining)) {
|
||||||
_set_time(_time_slice_ticks);
|
_set_time(_time_slice_duration);
|
||||||
} else {
|
} else {
|
||||||
/* Account previous elapsed time and reprogram
|
/* Account previous elapsed time and reprogram
|
||||||
* timer with remaining time
|
* timer with remaining time
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue