cee25393d8
- Fix P15-8-init-cycle-detection.patch: replace visiting+error with seen+silent-skip to eliminate 11 false-positive 'dependency cycle detected' errors on shared deps - Fix P0-daemon-fix-init-notify-unwrap.patch: remove eprintln! for missing INIT_NOTIFY (expected for oneshot_async services, ~7 daemons affected) - Fix driver-manager hotplug loop: add PERMANENTLY_SKIPPED static set shared between hotplug handler and DriverConfig::probe() to stop infinite re-probing of Fatal/NotSupported/deferred-exhausted device+driver pairs (e.g. ided) - Fix driver-manager log_timeline: suppress repeated EPIPE/ENOENT errors with AtomicI32 dedup and AtomicBool one-shot guards for boot timeline JSON - Add driver-manager SIGTERM handler, ACPI bus registration, --status mode, driver reap loop, graceful shutdown, and reduced deferred retries (30→3)
53 lines
2.2 KiB
Diff
53 lines
2.2 KiB
Diff
--- a/src/context/switch.rs
|
|
+++ b/src/context/switch.rs
|
|
@@ -26,6 +26,11 @@
|
|
Blocked,
|
|
}
|
|
|
|
+/// Default number of PIT ticks before triggering a context switch.
|
|
+/// At ~2.25 ms per tick, 3 ticks ≈ 6.75 ms timeslice.
|
|
+/// Configurable per-CPU via `ContextSwitchPercpu::preempt_interval`.
|
|
+const DEFAULT_PREEMPT_INTERVAL: usize = 3;
|
|
+
|
|
// A simple geometric series where value[i] ~= value[i - 1] * 1.25
|
|
const SCHED_PRIO_TO_WEIGHT: [usize; 40] = [
|
|
88761, 71755, 56483, 46273, 36291, 29154, 23254, 18705, 14949, 11916, 9548, 7620, 6100, 4904,
|
|
@@ -90,13 +95,15 @@
|
|
///
|
|
/// The function also calls the signal handler after switching contexts.
|
|
pub fn tick(token: &mut CleanLockToken) {
|
|
- let ticks_cell = &PercpuBlock::current().switch_internals.pit_ticks;
|
|
+ let percpu = PercpuBlock::current();
|
|
+ let ticks_cell = &percpu.switch_internals.pit_ticks;
|
|
|
|
let new_ticks = ticks_cell.get() + 1;
|
|
ticks_cell.set(new_ticks);
|
|
|
|
- // Trigger a context switch after every 3 ticks (approx. 6.75 ms).
|
|
- if new_ticks >= 3 {
|
|
+ // Trigger a context switch when the per-CPU preempt interval is reached.
|
|
+ let interval = percpu.switch_internals.preempt_interval.get();
|
|
+ if new_ticks >= interval {
|
|
switch(token);
|
|
crate::context::signal::signal_handler(token);
|
|
}
|
|
@@ -505,6 +512,10 @@
|
|
/// Per-CPU context switch flag. Set to true during a context switch on this CPU.
|
|
/// Replaced the global CONTEXT_SWITCH_LOCK to eliminate cross-CPU serialization.
|
|
in_context_switch: Cell<bool>,
|
|
+ /// Number of PIT ticks before triggering a context switch.
|
|
+ /// Default: 3 (≈6.75 ms). Lower values improve interactive responsiveness;
|
|
+ /// higher values improve throughput for batch/compute workloads.
|
|
+ preempt_interval: Cell<usize>,
|
|
|
|
current_ctxt: RefCell<Option<Arc<ContextLock>>>,
|
|
|
|
@@ -520,6 +531,7 @@
|
|
switch_time: Cell::new(0),
|
|
pit_ticks: Cell::new(0),
|
|
in_context_switch: Cell::new(false),
|
|
+ preempt_interval: Cell::new(DEFAULT_PREEMPT_INTERVAL),
|
|
current_ctxt: RefCell::new(None),
|
|
idle_ctxt: RefCell::new(None),
|
|
being_sigkilled: Cell::new(false),
|