sched: don't call k_sched_time_slice_set() during early init
All we really want here is to set default parameters. However k_sched_time_slice_set() also calls z_reset_time_slice(_current) which expects `_current` to be fully initialized. Simply initialize `slice_ticks` and `slice_max_prio` with default values directly. Unfortunately the compiler isn't smart enough to expand k_ms_to_ticks_ceil32(CONFIG_TIMESLICE_SIZE) to a constant expression at build time so we must do the conversion by hand (and it shouldn't overflow due to the nature of the value). Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This commit is contained in:
parent
405611dc9e
commit
524ac8a29a
|
@ -412,8 +412,8 @@ static void flag_ipi(void)
|
|||
|
||||
#ifdef CONFIG_TIMESLICING
|
||||
|
||||
static int slice_ticks;
|
||||
static int slice_max_prio;
|
||||
static int slice_ticks = (CONFIG_TIMESLICE_SIZE * Z_HZ_ticks + Z_HZ_ms - 1) / Z_HZ_ms;
|
||||
static int slice_max_prio = CONFIG_TIMESLICE_PRIORITY;
|
||||
static struct _timeout slice_timeouts[CONFIG_MP_MAX_NUM_CPUS];
|
||||
static bool slice_expired[CONFIG_MP_MAX_NUM_CPUS];
|
||||
|
||||
|
@ -1306,11 +1306,6 @@ void z_sched_init(void)
|
|||
#else
|
||||
init_ready_q(&_kernel.ready_q);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_TIMESLICING
|
||||
k_sched_time_slice_set(CONFIG_TIMESLICE_SIZE,
|
||||
CONFIG_TIMESLICE_PRIORITY);
|
||||
#endif
|
||||
}
|
||||
|
||||
int z_impl_k_thread_priority_get(k_tid_t thread)
|
||||
|
|
Loading…
Reference in a new issue