scheduler: load balancing initial implementation

This commit is contained in:
Matheus
2025-08-25 22:41:17 -03:00
parent 5db78acd72
commit a11406a600
4 changed files with 155 additions and 3 deletions
+1
View File
@@ -57,6 +57,7 @@ void sched_thread_wakeup_callback(thread_t *thread);
thread_t *sched_select_next_thread(void);
void sched_insert_in_cpu_queue(struct cpu_t *cpu, thread_t *thread);
void sched_preempt_cpu(struct cpu_t *cpu);
thread_t *sched_steal_work_from_cpu(struct cpu_t *cpu);
static inline int sched_thread_run_queue_index(int interactivity) {
return min(interactivity * SCHED_RUN_QUEUE_SIZE / SCHED_MAX_INTERACTIVITY, SCHED_RUN_QUEUE_SIZE - 1);
+1
View File
@@ -56,6 +56,7 @@ typedef struct cpu_t {
int last_interactivity;
int last_queue;
size_t thread_count;
size_t stealable_thread_count;
spinlock_t sched_lock;
timerentry_t calendar_tick_timer_entry;