Index: mysql-5.7.5-m15/mysys/thr_mutex.c =================================================================== --- mysql-5.7.5-m15.orig/mysys/thr_mutex.c +++ mysql-5.7.5-m15/mysys/thr_mutex.c @@ -187,17 +187,26 @@ int safe_mutex_destroy(my_mutex_t *mp, c #elif defined(MY_PTHREAD_FASTMUTEX) -static ulong mutex_delay(ulong delayloops) +# if defined(__powerpc__) +# define MY_LOW_PRIORITY_CPU() __asm__ __volatile__ ("or 1,1,1") +# define MY_RESUME_PRIORITY_CPU() __asm__ __volatile__ ("or 2,2,2") +# else +# define MY_LOW_PRIORITY_CPU() ((void)0) +# define MY_RESUME_PRIORITY_CPU() ((void)0) +# endif + +#define MY_COMPILER_BARRIER() __asm__ __volatile__ ("":::"memory") + +static void mutex_delay(ulong delayloops) { ulong i; - volatile ulong j; - j = 0; + MY_LOW_PRIORITY_CPU(); for (i = 0; i < delayloops * 50; i++) - j += i; + MY_COMPILER_BARRIER(); - return(j); + MY_RESUME_PRIORITY_CPU(); } #define MY_PTHREAD_FASTMUTEX_SPINS 8