Skip to main content

PerCpu

Struct PerCpu 

Source
#[repr(C)]
pub struct PerCpu { pub arch: PerCpuArch, present: AtomicBool, online: AtomicBool, apic_id: AtomicU32, kernel_stack_top: AtomicU64, tlb_ready: AtomicBool, pub preempt_count: AtomicU32, pub signal_pending: AtomicU32, }
Expand description

Per-CPU state.

Fields§

§arch: PerCpuArch§present: AtomicBool§online: AtomicBool§apic_id: AtomicU32§kernel_stack_top: AtomicU64§tlb_ready: AtomicBool§preempt_count: AtomicU32

Preemption-disable depth counter. When > 0, maybe_preempt() and yield_task() are no-ops on this CPU.

§signal_pending: AtomicU32

Fast signal-pending hint for the current CPU.

Set by send_signal when a signal targets the task currently running on this CPU. Checked by the syscall dispatcher to avoid the expensive current_task_clone() + scheduler lock when no signal is pending.

AtomicU32 (not AtomicBool) for better cache-line performance.

NOTE TODO : the extra bits are reserved for future fast-pending flags.

Implementations§

Source§

impl PerCpu

Source

pub const fn new() -> Self

Creates a new instance.

Source

pub fn apic_id(&self) -> u32

Performs the apic id operation.

Source

pub fn online(&self) -> bool

Performs the online operation.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.