Files
FUJITA Tomonori 842aedc390 rust: Add cpu_relax() helper
Add cpu_relax() helper in preparation for supporting
read_poll_timeout().

Reviewed-by: Alice Ryhl <[email protected]>
Reviewed-by: Andreas Hindborg <[email protected]>
Reviewed-by: Daniel Almeida <[email protected]>
Acked-by: Miguel Ojeda <[email protected]>
Signed-off-by: FUJITA Tomonori <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Danilo Krummrich <[email protected]>
2025-08-21 16:58:07 +02:00

15 lines
393 B
Rust

// SPDX-License-Identifier: GPL-2.0
//! Processor related primitives.
//!
//! C header: [`include/linux/processor.h`](srctree/include/linux/processor.h)
/// Lower CPU power consumption or yield to a hyperthreaded twin processor.
///
/// It also happens to serve as a compiler barrier.
#[inline]
pub fn cpu_relax() {
// SAFETY: Always safe to call.
unsafe { bindings::cpu_relax() }
}