• Marko Mäkelä's avatar
    MDEV-24973 Performance schema duplicates rarely executed code for mutex operations · 80ac9ec1
    Marko Mäkelä authored
    The PERFORMANCE_SCHEMA wrapper for mutex and rw-lock operations is
    causing a lot of unlikely code to be inlined in each invocation.
    The impact of this may have been emphasized in MariaDB 10.6, because
    InnoDB now uses the common implementation of mutexes and condition
    variables (MDEV-21452).
    
    By default, we build with cmake -DPLUGIN_PERFSCHEMA enabled,
    but at runtime no instrumentation will be enabled. Similar to
    commit eba2d10a
    we had better avoid inlining the rarely executed code in order to reduce
    the code size and to improve the efficiency of the instruction cache.
    
    This change was extensively tested by Axel Schwenke with and without
    --enable-performance-schema (with no individual instruments enabled).
    Removing the inline functions did not cause any performance regression
    in either case. There seemed to be a tiny improvement, possibly due
    to reduced code size and better instruction cache hit rate.
    80ac9ec1
my_thr_init.c 17 KB