mirror of
https://github.com/torvalds/linux.git
synced 2025-11-02 09:40:27 +02:00
Add cpu_relax() helper in preparation for supporting read_poll_timeout(). Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Acked-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com> Link: https://lore.kernel.org/r/20250821002055.3654160-2-fujita.tomonori@gmail.com Signed-off-by: Danilo Krummrich <dakr@kernel.org>
14 lines
393 B
Rust
14 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() }
|
|
}
|