Dave Watson
b23336af96
mutex: fix trylock spin wait contention
...
If there are 3 or more threads spin-waiting on the same mutex,
there will be excessive exclusive cacheline contention because
pthread_trylock() immediately tries to CAS in a new value, instead
of first checking if the lock is locked.
This diff adds a 'locked' hint flag, and we will only spin wait
without trylock()ing while set. I don't know of any other portable
way to get the same behavior as pthread_mutex_lock().
This is pretty easy to test via ttest, e.g.
./ttest1 500 3 10000 1 100
Throughput is nearly 3x as fast.
This blames to the mutex profiling changes, however, we almost never
have 3 or more threads contending in properly configured production
workloads, but still worth fixing.
2018-11-28 15:17:02 -08:00
..
2018-08-02 10:16:06 -07:00
2018-04-09 16:35:14 -07:00
2018-10-17 08:50:58 -07:00
2018-08-02 10:16:06 -07:00
2017-04-24 10:33:21 -07:00
2018-08-02 10:16:06 -07:00
2018-07-12 20:53:06 -07:00
2017-03-06 15:08:43 -08:00
2017-03-03 13:40:59 -08:00
2017-03-06 15:08:43 -08:00
2018-10-24 11:18:55 -07:00
2017-03-03 13:40:59 -08:00
2018-05-18 11:43:03 -07:00
2018-06-28 13:18:21 -07:00
2018-05-15 12:25:23 -07:00
2018-11-16 09:35:12 -08:00
2017-08-30 16:47:32 -07:00
2017-08-30 16:47:32 -07:00
2018-07-12 20:53:06 -07:00
2017-11-01 13:52:06 -07:00
2017-12-18 16:29:10 -08:00
2018-07-12 20:53:06 -07:00
2018-11-14 07:09:11 -08:00
2018-07-12 20:53:06 -07:00
2018-11-12 13:20:37 -08:00
2017-05-01 10:49:56 -07:00
2018-08-02 10:16:06 -07:00
2017-12-21 14:25:43 -08:00
2018-08-01 13:27:11 -07:00
2017-05-31 13:08:45 -07:00
2018-08-02 10:16:06 -07:00
2018-11-14 07:09:11 -08:00
2017-05-31 13:08:45 -07:00
2018-08-02 10:16:06 -07:00
2018-07-12 20:53:06 -07:00
2018-07-09 21:40:42 -07:00
2018-05-18 11:43:03 -07:00
2018-10-24 10:06:37 -07:00
2018-11-14 08:44:05 -08:00
2018-07-12 20:53:06 -07:00
2017-05-31 13:08:45 -07:00
2018-07-12 20:53:06 -07:00
2018-06-29 10:35:02 -07:00
2018-10-17 08:50:58 -07:00
2018-07-10 13:13:36 -07:00
2018-07-12 20:53:06 -07:00
2018-11-14 08:44:05 -08:00
2018-08-01 13:27:11 -07:00
2017-10-02 20:44:43 -07:00
2018-04-09 16:50:30 -07:00
2017-05-31 13:08:45 -07:00
2018-03-09 11:47:17 -08:00
2018-11-28 15:17:02 -08:00
2017-05-23 12:26:20 -07:00
2018-03-08 13:08:06 -08:00
2017-03-07 10:25:33 -08:00
2017-05-11 23:06:54 -07:00
2017-05-11 23:06:54 -07:00
2017-04-24 10:33:21 -07:00
2018-08-01 13:27:11 -07:00
2018-07-12 20:53:06 -07:00
2018-10-23 12:39:57 -07:00
2018-10-15 08:24:12 -07:00
2017-02-16 09:39:46 -08:00
2017-01-20 21:45:53 -08:00
2014-01-16 17:38:01 -08:00
2017-04-11 11:52:30 -07:00
2017-01-20 21:45:53 -08:00
2018-07-12 20:53:06 -07:00
2017-04-11 11:52:30 -07:00
2018-07-09 21:40:42 -07:00
2018-11-12 13:20:37 -08:00
2018-08-02 10:16:06 -07:00
2018-05-18 11:43:03 -07:00
2017-05-25 16:52:10 -07:00
2017-05-25 16:52:10 -07:00
2017-10-04 18:37:23 -07:00
2018-08-02 10:16:06 -07:00
2018-10-17 08:50:58 -07:00
2018-07-12 20:53:06 -07:00
2018-11-13 08:54:09 -08:00
2018-07-12 20:53:06 -07:00
2018-11-13 08:54:09 -08:00
2018-05-18 11:43:03 -07:00
2018-10-18 08:32:19 -07:00
2018-07-09 21:40:42 -07:00
2018-10-15 10:11:08 -07:00
2018-10-15 10:11:08 -07:00
2017-05-01 10:49:56 -07:00
2017-05-01 10:49:56 -07:00
2018-10-15 08:24:12 -07:00
2017-04-24 15:02:45 -07:00
2018-08-01 13:27:11 -07:00