Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-28137

Some memory transactions are unnecessarily complex

Details

    Description

      The MDEV-26769 implementation of memory transactions may invoke a system call within a memory transaction if a page latch is not available in buf_page_get_zip().

      In the Intel TSX-NI implementation (CPUID flag rtm), system calls will lead to the memory transaction being aborted, and there should be no correctness problem. The POWER v2.07 Hardware Transactional Memory allows memory transactions to execute system calls with some limitations, but our implementation assumes that no system calls will be executed as part of a memory transaction.

      Furthermore, many memory transactions contain read-modify-write operations, such as std::atomic::fetch_add(). Inside memory transactions, plain loads and stores would work equally well and could result in more efficient code.

      Attachments

        Issue Links

          Activity

            danblack Daniel Black added a comment -

            POWER note, the original capability test was for transactions to be suspended in syscalls. Without this it will tabort on syscalls like Intel. So if the syscalls in `buf_page_get_zip` are executed, is there a correctness problem? After that its determining if the abort condition is rare enough for there to be a performance gain.

            danblack Daniel Black added a comment - POWER note, the original capability test was for transactions to be suspended in syscalls. Without this it will tabort on syscalls like Intel. So if the syscalls in `buf_page_get_zip` are executed, is there a correctness problem? After that its determining if the abort condition is rare enough for there to be a performance gain.
            danblack Daniel Black added a comment - review added on https://github.com/mariaDB/server/commit/531516688fe8894b477b55664e188bb10f5a48de

            bb-10.6-MDEV-28137, origin/bb-10.6-MDEV-28137 531516688fe8894b477b55664e188bb10f5a48de 2022-03-21T11:49:18+02:00
            behaved well in RQG testing on boxes where the CPU model does
            - support "rtm"    Server error log message "[Note] InnoDB: Using transactional memory"
            - not support rtm
            

            mleich Matthias Leich added a comment - bb-10.6-MDEV-28137, origin/bb-10.6-MDEV-28137 531516688fe8894b477b55664e188bb10f5a48de 2022-03-21T11:49:18+02:00 behaved well in RQG testing on boxes where the CPU model does - support "rtm" Server error log message "[Note] InnoDB: Using transactional memory" - not support rtm

            Performance testing by axel showed a small consistent regression and a somewhat worse ratio of tx-abort to tx-start events. I implemented a reduced version, only modifying the rarely executed functions buf_page_get_zip() and buf_page_init_for_read(). The latter change should benefit any CPU, because some read-modify-write updates of block descriptor state will be removed.

            marko Marko Mäkelä added a comment - Performance testing by axel showed a small consistent regression and a somewhat worse ratio of tx-abort to tx-start events. I implemented a reduced version , only modifying the rarely executed functions buf_page_get_zip() and buf_page_init_for_read() . The latter change should benefit any CPU, because some read-modify-write updates of block descriptor state will be removed.

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.