Expand description
Deferred work queue — softirq-equivalent for Strat9-OS.
Moves heavy tick processing out of the hardirq handler into safe execution contexts (post-switch, idle loop, syscall return).
§Design
Each CPU has a lock-free AtomicU32 bitmask of pending work items.
The hardirq timer handler calls raise_deferred_work() which sets bits
atomically — no locks, no allocation, O(1) cost.
Processing happens at safe points where IRQs may be re-enabled and scheduler locks can be acquired without deadlock:
finish_switch()— after cooperative context switch completesfinish_interrupt_switch()— after interrupt-driven switch completesidle_task_main()— idle loop before HLTmaybe_preempt()— at preemption entry (for work raised during IRQ)
§What stays in hardirq
- TICK_COUNT, CPU_TOTAL_TICKS, CPU_LOCAL_TICKS increments (lock-free)
- FORCE_RESCHED_HINT setting (lock-free)
- speaker_tick, n3_watchdog_tick (minimal)
- EOI (must be immediate)
§What moves to deferred
tick_all_timers()— interval timer processingcheck_wake_deadlines()— deadline-based wakeups- Per-task Fair class accounting (runnable_len, tick_update_wait)
Structs§
- Deferred
Work 🔒Cpu - Per-CPU deferred work state.
- Deferred
Work Metrics - Snapshot of deferred work metrics across all CPUs.
Enums§
- Deferred
Work - Work item types that can be deferred from hardirq context.
Statics§
- DEFERRED_
WORK 🔒 - Per-CPU deferred work queues.
Functions§
- has_
pending - Check if there is pending deferred work on the current CPU.
- metrics_
snapshot - Take a snapshot of deferred work metrics.
- process_
deferred_ work - Process deferred work items for the current CPU.
- process_
per_ 🔒task_ accounting - Process per-task Fair class accounting for the current CPU.
- raise_
deferred_ work - Raise deferred work items for the current CPU.
- raise_
tick_ deferred_ work - Raise all tick-related deferred work items for the current CPU.
- reset_
metrics - Reset deferred work metrics.