mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
scheduler: only run load balance when appropriate
Prevent the load balancer from balancing when running uniprocessor machines and when not all CPUs are online yet. This prevents a race between ap initialization and load balancing.
This commit is contained in:
@@ -353,7 +353,9 @@ void sched_calendar_tick(context_t *, dpcarg_t) {
|
||||
// note that there has to be a migrateable thread for this to be possible.
|
||||
// (so if a thread targets the cpu it is ignored in the count)
|
||||
void sched_load_balancer(context_t *, dpcarg_t) {
|
||||
if (!smp_cpus)
|
||||
size_t cpu_count = arch_smp_get_cpu_count();
|
||||
if (cpu_count < 2 ||
|
||||
__atomic_load_n(&arch_smp_cpusawake, __ATOMIC_ACQUIRE) != cpu_count)
|
||||
return;
|
||||
|
||||
interrupt_set(false);
|
||||
|
||||
Reference in New Issue
Block a user