mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 04:52:02 +08:00
arch/x86_64: use pause to reduce power consumption in spin wait loops
Signed-off-by: humzak711 <humzak711@gmail.com> This commit defines the UP_WFE() macro as the 'pause' instruction for x86_64. This optimization reduces power consumption and prevents pipeline flushes caused by memory ordering violations during contended spinlock acqusitions
This commit is contained in:
@@ -41,6 +41,8 @@
|
||||
|
||||
/* Include architecture-specific definitions */
|
||||
|
||||
#include <arch/barriers.h>
|
||||
|
||||
#ifdef CONFIG_ARCH_INTEL64
|
||||
# include <arch/intel64/arch.h>
|
||||
#endif
|
||||
|
||||
@@ -29,5 +29,6 @@
|
||||
#define UP_DMB() __asm__ __volatile__ ("mfence" ::: "memory")
|
||||
#define UP_RMB() __asm__ __volatile__ ("lfence" ::: "memory")
|
||||
#define UP_WMB() __asm__ __volatile__ ("sfence" ::: "memory")
|
||||
#define UP_WFE() __asm__ __volatile__ ("pause")
|
||||
|
||||
#endif /* __ARCH_X86_64_INCLUDE_BARRIERS_H */
|
||||
|
||||
Reference in New Issue
Block a user