I see cache coherency and interconnect traffic issue with respect to the random function generator ut_rnd_ulint_counter() while doing a backoff in spin lock.
I was looking at MySQL repository and see that there is a patch
given to resolve this issue. I see a good amount of benefit for Arm platform around 5-10% and for Intel 3-5% for sysbench oltp test write . In general this looks to be a good idea .
I also see MYSQL backed off it in 5.20 because of performance reason but the changes brought some scalability issue with the patch dedc8b3d567fbb92ce912f1559fe6a08b2857045
Again on Version 8.0 this has been committed again with the patch https://github.com/mysql/mysql-server/commit/32b184cad3ebd68281fb0076a24a634d2f330aa1with some new changes.
However I am trying to port this to Mariadb but there a lot of code difference so no way I can port directly and provide a patch to test. I see files my_thread_local.h being not available and if I try to create there are some merge clashes with my_pthread.h .
Please let me know your opinion and if required I can share a patch soon with the above issues resolved.