[MDEV-24308] os_thread_get_curr_id() et al. introduce unnecessary function call overhead Created: 2020-11-30  Updated: 2020-12-03  Resolved: 2020-11-30

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.5.9, 10.6.0

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: performance


 Description   

The os0thread.cc module unnecessarily defines non-inlined function call wrappers for trivial operations.

os_thread_pf() simply casts the argument to a different type, and it should not exist at all.

The functions os_thread_eq(), os_thread_yield(), os_thread_get_curr_id() are better defined as macros that refer to the Microsoft Windows and POSIX interfaces.

Because os_thread_get_curr_id() is being invoked in locking code, this simplification could slightly improve performance.



 Comments   
Comment by Marko Mäkelä [ 2020-11-30 ]

For some reason, this change was causing assertion failures in the InnoDB rw_lock_t code on Windows. Hence, I restored os_thread_eq(), os_thread_yield(), os_thread_get_curr_id() as functions on Windows. Such failures were not observed in combination with MDEV-24142.

Comment by Marko Mäkelä [ 2020-12-03 ]

As part of MDEV-24142 I restored the optimizations for Microsoft Windows in MariaDB 10.6.0. Also os_thread_sleep() will be a macro on Microsoft Windows, but it will remain a function elsewhere.

Generated at Thu Feb 08 09:29:00 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.