Bug #100214 Optimize InnoDB code around mutexes assuming InnoDB locks are uncontended
Submitted: 14 Jul 2020 13:15 Modified: 14 Jul 2020 13:45
Reporter: Dmitriy Philimonov Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S5 (Performance)
Version:8.0.20 OS:Any
Assigned to: CPU Architecture:ARM
Tags: compiler

[14 Jul 2020 13:15] Dmitriy Philimonov
Description:
The InnoDB engine locks have low contention during OLTP_PS/RO sysbench tests.
Assuming this we used compiler specific attributes to annotate code near
mutexes making code path acquiring lock easier. Specifically, branches which
lead to ut_delay() function were marked `unlikely` and functions which call
ut_delay() were marked `cold`. We got persistent +2% improvement
in sysbench OLTP_PS 128 thread, meanwhile sysbench OTLP_RO/RW results almost
didn't change.

Our environment: Kunpeng 920 (64 cores), Ubuntu 20.04, kernel 5.6.0 with 64K
pages, gcc-9.3.0.

How to repeat:
Check how nspins/nwaits counters attached to TTASEventMutex change during
sysbench OLTP_PS/RO benchmarks.

Suggested fix:
Mark all branches, which lead eventually to ut_delay(), as unlikely for the
compiler, the code which contains ut_delay() should be marked with `cold`
attribute.
[14 Jul 2020 13:45] MySQL Verification Team
Hi Mr. Philimonov,

Thank you, very much, for your performance improvement ideas regarding the ARM architecture.

Thank you for your contributed patch. It would be very nice of you if you would upload other patches , when you find some time.

Verified as reported.