-
Marc Alff authored
MySQL Bug 101018 HIGH CONTENTION ON LAST_VALUE IN MY_TIMER_MICROSECONDS Contribution by Georgy Kirichenko. For historical reasons, in the timer code in mysys, in the functions my_timer_nanoseconds() and my_timer_microseconds(), the code used to save the result of gettimeofday() in a global variable, and return this global variable, incremented, in case of subsequent failures of gettimeofday(). The intent then was to provide, even in case of failures, a seemingly functional timer. This alternate timer would not measure time correctly but at least would still be monotonously increasing, to avoid causing unexpected side effects in the caller. Later, access to this global variable, by definition done by many threads, was protected to use atomic operations, to fix races reported (rightly so) by runtime sanitizers. The net effect is now code that causes contentions, when executed by many threads in parallel, on modern CPUs with many cores. This leads to performance degradations. The fix is to remove the global atomic variable entirely, which is no longer justified. Approved by: Chris Powers <chris.powers@oracle.com>
Marc Alff authoredMySQL Bug 101018 HIGH CONTENTION ON LAST_VALUE IN MY_TIMER_MICROSECONDS Contribution by Georgy Kirichenko. For historical reasons, in the timer code in mysys, in the functions my_timer_nanoseconds() and my_timer_microseconds(), the code used to save the result of gettimeofday() in a global variable, and return this global variable, incremented, in case of subsequent failures of gettimeofday(). The intent then was to provide, even in case of failures, a seemingly functional timer. This alternate timer would not measure time correctly but at least would still be monotonously increasing, to avoid causing unexpected side effects in the caller. Later, access to this global variable, by definition done by many threads, was protected to use atomic operations, to fix races reported (rightly so) by runtime sanitizers. The net effect is now code that causes contentions, when executed by many threads in parallel, on modern CPUs with many cores. This leads to performance degradations. The fix is to remove the global atomic variable entirely, which is no longer justified. Approved by: Chris Powers <chris.powers@oracle.com>
Loading