base,sim: implement a faster mutex for single thread case
authorEarl Ou <shunhsingou@google.com>
Tue, 22 Sep 2020 06:06:30 +0000 (14:06 +0800)
committerEarl Ou <shunhsingou@google.com>
Mon, 28 Sep 2020 02:30:41 +0000 (02:30 +0000)
commitff6a3a61719974de808b2695153144a9ea9c3d1d
tree5ee80fa60fcbf93d241ad31f9faa0dd24bdb5e37
parent9de667af6e92ab709850dfc4ab25e48093e351ba
base,sim: implement a faster mutex for single thread case

This change applies an atomic variable to check if we really need to
obtain a mutex, and uses a condition variable to notify.

See about 5% improvement in the simulation speed.

Change-Id: I7e165987dcb587b27fae90978b9b3fde6f5563ef
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34915
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/base/SConscript
src/base/uncontended_mutex.hh [new file with mode: 0644]
src/base/uncontended_mutex.test.cc [new file with mode: 0644]
src/sim/eventq.cc
src/sim/eventq.hh