Message ID | 1481512100-10380-3-git-send-email-peterx@redhat.com |
---|---|
State | New |
Headers | show |
diff --git a/lib/x86/asm/barrier.h b/lib/x86/asm/barrier.h index 7c108bd..193fb4c 100644 --- a/lib/x86/asm/barrier.h +++ b/lib/x86/asm/barrier.h @@ -13,4 +13,15 @@ #define smp_rmb() barrier() #define smp_wmb() barrier() +/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ +static inline void rep_nop(void) +{ + asm volatile("rep; nop" ::: "memory"); +} + +static inline void cpu_relax(void) +{ + rep_nop(); +} + #endif