[PATCH v7 2/2] Mutex: Replace trylock by read only while spinning
kemi
kemi.wang@intel.com
Wed Jul 11 03:21:00 GMT 2018
Hi, Carlos
>> Do you need to do a whole system performance measurement?
>
> I thought the data posted here is good enough to demonstrate the effectiveness of this patch.
> But if you insist, I will try to do something to figure it out.
>
To measure a whole system performance:
We run *two* processes with locking at the same time. Each process has multiple threads, and
each thread do the following:
a) lock
b) delay 1000ns in the critical section
c) unlock
d) delay 6000ns in the non-critical section
in a loop for 5 seconds, and measure the total iterations for each process.
Each test run 4 times with stable testing result.
Test result:
threads base(CAS) head(test and CAS)
28 1681975 1813090(+7.8%)
56 1801954 1890549(+4.9%)
========================cut==========================================
I also run a *single* process and post the test result as below (each test run 4 times with
stable testing result):
threads base(CAS) head(test and CAS)
28 2262848 2274362 (+0.5%)
56 1949439 1994526 (+2.3%)
This is what I got in my test, this change is not a big optimization, but should have some
limited performance improvement. Additionally, the workload I run here is not so Macro
(Some Micro benchmarks make the size of critical section and non-critical section extremely
small), so I believe this change is helpful with some practical workload.
More information about the Libc-alpha
mailing list