xref: /linux/rust/kernel/processor.rs (revision 4f38da1f027ea2c9f01bb71daa7a299c191b6940)
1*842aedc3SFUJITA Tomonori // SPDX-License-Identifier: GPL-2.0
2*842aedc3SFUJITA Tomonori 
3*842aedc3SFUJITA Tomonori //! Processor related primitives.
4*842aedc3SFUJITA Tomonori //!
5*842aedc3SFUJITA Tomonori //! C header: [`include/linux/processor.h`](srctree/include/linux/processor.h)
6*842aedc3SFUJITA Tomonori 
7*842aedc3SFUJITA Tomonori /// Lower CPU power consumption or yield to a hyperthreaded twin processor.
8*842aedc3SFUJITA Tomonori ///
9*842aedc3SFUJITA Tomonori /// It also happens to serve as a compiler barrier.
10*842aedc3SFUJITA Tomonori #[inline]
11*842aedc3SFUJITA Tomonori pub fn cpu_relax() {
12*842aedc3SFUJITA Tomonori     // SAFETY: Always safe to call.
13*842aedc3SFUJITA Tomonori     unsafe { bindings::cpu_relax() }
14*842aedc3SFUJITA Tomonori }
15