Skip to main content

preempt_disable

Function preempt_disable 

Source
pub fn preempt_disable()
Expand description

Increment the preemption-disable depth for the current CPU. When depth > 0, the scheduler will not preempt this CPU.

Safe to call from any Ring-0 context after init_gs_base has run on this CPU. If called before GS is initialised (early boot), current_cpu_index returns 0, which is always the BSP slot. On the BSP itself that is correct; on an AP before its GS base is set the call is a no-op because the AP’s scheduler is not yet running — incrementing slot 0 would be wrong, so we verify the GS index matches the slot we are about to touch.