]> 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)
commit517e5dca7b246886d1421baf5c70983879a4a494
tree369949d054aa9e5cbc361c72ee3be7b4fbaa8173
parent4540bb2a4c68a254bfdb955a9464c25d2c6eef9b
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