XtraDB Priority Mutex
Implement a priority mutex. It is in every aspect the same as the regular ib_mutex_t, with the difference that waiters can designated as low priority (the default), or high priority. Then, upon a mutex exit with waiters present, only the high priority waiters will be signalled if there is at least one of them. If only low-priority waiters are present, then they will be signalled.
Such design would be unsafe for general use as there are no protections from starving low-priority threads indefinitely. However, it's OK for the InnoDB utility threads as all of them throttle themselves. Another potential issue is that low priority threads can still acquire the mutex before the high priority threads through the spinning in the time window between the high-priority waiters waking up and locking the mutex. This may be addressed in follow-up if needed.
The priority mutex is implemented as a new separate mutex type instead of blanket-converting all of the InnoDB mutexes. Even though it increases the patch size, it appears to be a better option because 1) the performance effect of blanket conversion has not been tested and it is possible that for mutexes that don't need it it's pure overhead; 2) the blanket conversion would convert all the buffer pool block mutexes, increasing the memory consumption significantly yet mostly needlessly.
To minimize the patch size, priority mutex API is new C++ overloads for regular mutex API for mutex_exit, mutex_own, mutex_create, mutex_free, mutex_enter_nowait. For mutex acquisition the overloaded [pfs_]mutex_
Convert the following mutexes to priority mutex: dict_sys, LRU list, rseg, log, hash table sync object array. Other mutexes might be converted later as needed.
- Alexey Kopytov
- Laurynas Biveinis
- Laurynas Biveinis
- Series goal:
- Accepted for 5.6
- Milestone target:
- Started by
- Laurynas Biveinis on 2013-09-21
- Completed by
- Laurynas Biveinis on 2013-09-27
* Blueprints in grey have been implemented.