Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-103010

Optimize tight CAS loops with x86 PAUSE / ARM YIELD instructions.

    XMLWordPrintable

    Details

    • Type: Epic
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Core: Threads, Other
    • Labels:
      None
    • Epic Name:
      qYieldCpu()

      Description

      Thiago Macieira recently merged the addition of an _mm_pause() in a tight compare-and-swap loop in QFutureInterface: https://codereview.qt-project.org/c/qt/qtbase/+/407431

      He links to various sources that detail why that is a good idea.

      But we have many such loops in Qt, and adding that Q_PROCESSOR #ifdef'ery is making the code ugly. And besides, ARM has the YIELD instruction, which is serving the same purpose.

      So, we need to have a function, say qYieldCpu(), to encapsulate all this, and then roll this out to other CAS loops, too.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            cnn Qt Core & Network
            Reporter:
            mmutz Marc Mutz
            PM Owner:
            Vladimir Minenko Vladimir Minenko
            RnD Owner:
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes