]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
feat: per-CPU scheduler runqueue infrastructure with load tracking
authorTulio A M Mendes <[email protected]>
Sun, 15 Feb 2026 02:47:29 +0000 (23:47 -0300)
committerTulio A M Mendes <[email protected]>
Sun, 15 Feb 2026 02:47:29 +0000 (23:47 -0300)
commita9d555762632d2364baa078a8e191ac061b35b9b
treee4b3bcac0561fa94f0d99c5462b23c6a8ff6cd05
parentc6dcad00a46fe7942425db07b7bfce46943152ff
feat: per-CPU scheduler runqueue infrastructure with load tracking

- Add rq_load field to percpu_data struct (offset 20, struct stays 32 bytes)
- New sched_pcpu module: per-CPU load counters with atomic operations
  - sched_pcpu_init(): initialize for N CPUs after SMP enumeration
  - sched_pcpu_inc_load/dec_load(): lock-free load tracking
  - sched_pcpu_least_loaded(): find CPU with fewest ready processes
  - sched_pcpu_get_load(): query per-CPU load
- Integrate load tracking into scheduler enqueue/dequeue paths
- Wire up sched_pcpu_init() in arch_platform_setup after percpu_setup_gs
- All 35/35 smoke tests pass, 16/16 battery, cppcheck clean
include/arch/x86/percpu.h
include/sched_pcpu.h [new file with mode: 0644]
src/arch/x86/arch_platform.c
src/kernel/sched_pcpu.c [new file with mode: 0644]
src/kernel/scheduler.c