Bug #52806 Make InnoDB mutexes green
Submitted: 14 Apr 2010 6:32 Modified: 26 Jan 2022 12:34
Reporter: Mark Callaghan Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: InnoDB Plugin storage engine Severity:S5 (Performance)
Version:5.1 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: green, innodb, mutex

[14 Apr 2010 6:32] Mark Callaghan
The InnoDB mutex wakes all waiting threads on unlock. This wastes CPU power as only 1 threads can get the lock. NPTL mutex code wakes one thread using futex calls -- read the glibc source. I know InnoDB can do something similar. I even hacked up a change to do this and produced sysbench numbers that match performance without the change while cutting CPU consumption in half.

How to repeat:
Run a test with a lot of mutex contention

Suggested fix:
Wake one thread instead of all threads.
[16 Oct 2012 15:16] Mark Callaghan
More details at https://www.facebook.com/notes/mysql-at-facebook/green-mutexes/10151060544265933
[17 Oct 2012 18:05] Mark Callaghan
More details at https://www.facebook.com/notes/mysql-at-facebook/green-mutexes-part-2/10151061901390933
[26 Jan 2022 12:34] MySQL Verification Team
This was fixed in WL#6044 and pushed to 5.7.2. By using futexes on Linux we
can replace the condition variable broadcast with a "signal".

This bug should be closed.