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

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

    XMLWordPrintable

Details

    • Epic
    • Status: Closed
    • P3: Somewhat important
    • Resolution: Fixed
    • None
    • None
    • Core: Threads, Other
    • None
    • qYieldCpu()

    Description

      thiago 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

            cnn Qt Core & Network
            mmutz Marc Mutz
            Vladimir Minenko Vladimir Minenko
            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