kernel: apply P5-context-mod-sched, P8-percpu-sched, P8-percpu-wiring
Phase 0c, plan orders #3, #4, #7. P5-context-mod-sched: re-export SchedPolicy from context::mod (one-line change to the use statement). The type is defined in context::context by the previous P7-cache-affine-context commit; this just makes it available as crate::context::SchedPolicy. P8-percpu-sched: adds PerCpuSched struct to percpu.rs with SyncUnsafeCell- wrapped run_queues, balance/last_queue/last_balance_time cells, and take_lock/release_lock methods. Refactors PercpuBlock to embed PerCpuSched as 'sched' field instead of standalone 'balance'/'last_queue' fields. Adds get_percpu_block() helper. P8-percpu-wiring: rewrites src/context/switch.rs to consume PerCpuSched: - select_next_context reads from percpublock.sched.queues() instead of the global RunContextData.set - Initial placement chooses least-loaded CPU via PercpuSched.balance - Load balance trigger fires periodically and migrates contexts between per-CPU queues respecting sched_affinity - Adds pub const fn to access per-cpu sched state safely After this commit, the kernel builds with per-CPU run queues wired into the scheduler. cargo check still has 1 pre-existing unrelated error (src/acpi/fadt.rs:110 type mismatch) that predates the threading work. Combined with the P6-futex-sharding commit, this completes the foundation for Phase 1 (Futex Completeness) and Phase 2 (SMP Scheduling Quality).
This commit is contained in:
+1
-1
@@ -22,7 +22,7 @@ use crate::{
|
||||
|
||||
use self::context::Kstack;
|
||||
pub use self::{
|
||||
context::{BorrowedHtBuf, Context, Status},
|
||||
context::{BorrowedHtBuf, Context, SchedPolicy, Status},
|
||||
switch::switch,
|
||||
};
|
||||
|
||||
|
||||
+747
-167
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user