pub fn maybe_preempt()Expand description
Called from the timer interrupt handler (or a resched IPI) to potentially preempt the current task.
This is safe to call from interrupt context because:
- IF is already cleared by the CPU when entering the interrupt.
- We use
try_lock()- if the scheduler is already locked (e.g.,yield_task()is in progress), we simply skip preemption for this tick. - We honour the
PreemptGuard: if preemption is disabled, we return.