Module cpu_local

Source
Expand description

This module maintains preemption-related information for the current task on a CPU with a single 32-bit, CPU-local integer value.

  • Bits from 0 to 30 represents an unsigned counter called guard_count, which is the number of DisabledPreemptGuard instances held by the current CPU;
  • Bit 31 is set to !need_preempt, where need_preempt is a boolean value that will be set by the scheduler when it decides that the current task needs to be preempted.

Thus, the current task on a CPU should be preempted if and only if this integer is equal to zero.

The initial value of this integer is equal to 1 << 31.

This module provides a set of functions to access and manipulate guard_count and need_preempt.

Constantsยง

GUARD_COUNT_MASK ๐Ÿ”’
NEED_PREEMPT_MASK ๐Ÿ”’

Staticsยง

PREEMPT_INFO ๐Ÿ”’

Functionsยง

clear_need_preempt ๐Ÿ”’
dec_guard_count ๐Ÿ”’
get_guard_count ๐Ÿ”’
inc_guard_count ๐Ÿ”’
need_preempt ๐Ÿ”’
set_need_preempt ๐Ÿ”’
should_preempt ๐Ÿ”’
Returns whether the current task should be preempted or not.