Nuances related to Spinlock implementation and the Linux Scheduler

By: Beastian (no.email.delete@this.aol.com),
Room: Moderated Discussions
I'm usually on the other side of these primitives when I write code as a consumer of them, but it's very interesting to read about the nuances related to their implementations:

https://probablydance.com/2019/12/30/measuring-mutexes-spinlocks-and-how-bad-the-linux-scheduler-really-is/

The problem was that there was a thread that spent several milliseconds trying to acquire a spinlock at a time when no other thread was holding the spinlock.


 Next Post in Thread >
Thread (397 posts)
TopicPosted ByPosted
Nuances related to Spinlock implementation and the Linux SchedulerBeastian
  Nuances related to Spinlock implementation and the Linux SchedulerMontaray Jack
    Nuances related to Spinlock implementation and the Linux SchedulerMontaray Jack
  No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Linus Torvalds
    No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Beastian
    No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Malte Skarupke
      No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Linus Torvalds
        No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)dmcq
        No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)smeuletz
          Do not blame others for your unfinished jobsmeuletz
            Where did all the experts come from? Did Linus get linked? (NT)anon
              PhoronixGabriele Svelto
                PhoronixSalvatore De Dominicis
            Do not blame anyone. Please give polite, constructive criticismChester
              Do not blame anyone. Please give polite, constructive criticismsmeuletz
                Do not blame anyone. Please give polite, constructive criticismChester
                  Do not blame anyone. Please give polite, constructive criticismsmeuletz
                    Do not blame anyone. Please give polite, constructive criticismLinus Torvalds
                      Do not blame anyone. Please give polite, constructive criticismGionatan Danti
                        Do not blame anyone. Please give polite, constructive criticismLinus Torvalds
                          Do not blame anyone. Please give polite, constructive criticismGionatan Danti
                          Do not blame anyone. Please give polite, constructive criticismJohn Scott
                          Do not blame anyone. Please give polite, constructive criticismsupernovas
                            Do not blame anyone. Please give polite, constructive criticismLinus Torvalds
                          Do not blame anyone. Please give polite, constructive criticismGDan
                            OracleAnon3
                      Do not blame anyone. Please give polite, constructive criticismsmeuletz
                        Do not blame anyone. Please give polite, constructive criticismSimon Farnsworth
                        Do not blame anyone. Please give polite, constructive criticismEtienne
                          Do not blame anyone. Please give polite, constructive criticismsmeuletz
                            Do not blame anyone. Please give polite, constructive criticismMichael S
                      Not deprecating irrelevant API: sched_yield() on quantum computers?smeuletz
                      Do not blame anyone. Please give polite, constructive criticismmagicalgoat
                        Do not blame anyone. Please give polite, constructive criticismLinus Torvalds
                          Do not blame anyone. Please give polite, constructive criticismAnon3
                  Do not blame anyone. Please give polite, constructive criticismrwessel
                Do not blame anyone. Please give polite, constructive criticismLinus Torvalds
                  Do not blame anyone. Please give polite, constructive criticismGabriele Svelto
        No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Howard Chu
          No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Linus Torvalds
      No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)president ltd
    No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Jörn Engel
      No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Emil Briggs
        No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Jörn Engel
      No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Linus Torvalds
        No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Linus Torvalds
          No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Jörn Engel
            No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Linus Torvalds
              FUTEX_LOCK_PI performanceJörn Engel
                FUTEX_LOCK_PI performanceLinus Torvalds
                  FUTEX_LOCK_PI performanceJörn Engel
                    FUTEX_LOCK_PI performanceRichardC
                      FUTEX_LOCK_PI performanceLinus Torvalds
                  FUTEX_LOCK_PI performanceGabriele Svelto
                    FUTEX_LOCK_PI performancexilun
                    FUTEX_LOCK_PI performanceKonrad Schwarz
                      FUTEX_LOCK_PI performanceGabriele Svelto
                      FUTEX_LOCK_PI performanceSimon Farnsworth
                      FUTEX_LOCK_PI performancerwessel
    No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)rainstar
      No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Charles Ellis
        No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Richard
          It's hard to separateMichael S
            It's hard to separaterainstared
              It's hard to separateDavid Kanter
                It's hard to separateAnon
                  It's hard to separatenone
                    It's hard to separateAnon
                      It's hard to separatenone
                        It's hard to separategallier2
                          It's hard to separateAnon
                            It's hard to separateAdrian
                              It's hard to separategallier2
                                It's hard to separateAdrian
                            It's hard to separategallier2
                        It's hard to separateAdrian
                        It's hard to separateAnon
                          It's hard to separategallier2
                          It's hard to separateDavid Hess
                            It's hard to separateAdrian
                              It's hard to separateDavid Hess
                                It's hard to separateAnon
                                  It's hard to separateAdrian
                                    It's hard to separateBrett
                                      Zilog Z8000Brett
                                        Zilog Z8000David Hess
                                          Zilog Z8000Adrian
                                            Zilog Z8000David Hess
                                              Zilog Z8000Ricardo B
                                                Zilog Z8000Ronald Maas
                                                  Zilog Z8000Ricardo B
                                                    Zilog Z8000Anon
                                                      Zilog Z8000Jose
                                                        Zilog Z8000gallier2
                                                          Zilog Z8000Jose
                                                            Zilog Z8000rwessel
                                                              Zilog Z8000David Hess
                                                                Zilog Z8000Simon Farnsworth
                                                                  Zilog Z8000Michael S
                                                                    Zilog Z8000Simon Farnsworth
                                                                      Zilog Z8000David Hess
                                                                  Zilog Z8000David Hess
                                                                Zilog Z8000rwessel
                                                                  286 16 bit I/OTim McCaffrey
                                                                    286 16 bit I/ODavid Hess
                                                      Zilog Z8000Ricardo B
                                                        Zilog Z8000Anon
                                                          Zilog Z8000David Hess
                                                            Zilog Z8000rwessel
                                                              Zilog Z8000David Hess
                                                          Zilog Z8000someone
                                                            Zilog Z8000Anon
                                                          Zilog Z8000Ricardo B
                                                  Zilog Z8000Simon Farnsworth
                                                    Zilog Z8000Tim McCaffrey
                                                      Zilog Z8000Simon Farnsworth
                                                    Zilog Z8000Ricardo B
                                                      Zilog Z8000Anon
                                                        Zilog Z8000Ricardo B
                                                          Zilog Z8000Anon
                                                            Zilog Z8000Ricardo B
                                                              Zilog Z8000Anon
                                                                Zilog Z8000David Hess
                                                                Zilog Z8000Ricardo B
                                                                  Zilog Z8000Anon
                                                                    Zilog Z8000Ronald Maas
                                                                      Zilog Z8000Anon
                                                                    Zilog Z8000Ricardo B
                                                                      Zilog Z8000Anon
                                                                        Zilog Z8000Ricardo B
                                                                          Zilog Z8000gallier2
                                                                    Zilog Z8000David Hess
                                                            Zilog Z8000David Hess
                                                          Zilog Z8000gallier2
                                                      Zilog Z8000Simon Farnsworth
                                                        IBM PC successEtienne
                                                        Zilog Z8000Ricardo B
                                                          Zilog Z8000Brett
                                                            Zilog Z8000David Hess
                                                          Zilog Z8000David Hess
                                                    Zilog Z8000David Hess
                                            Zilog Z8000Maxwell
                                              Zilog Z8000David Hess
                                                Zilog Z8000Maxwell
                                                  Zilog Z8000Ricardo B
                                                    8086 does NOT have those addressing modesDevin
                                                      8086 does NOT have those addressing modesRicardo B
                                                        8086 does NOT have those addressing modesAnon
                                                          8086 does NOT have those addressing modesgallier2
                                                            8086 does NOT have those addressing modesAnon
                                                              8086 does NOT have those addressing modesRicardo B
                                                          8086 does NOT have those addressing modesMichael S
                                                            Zilog Z8000Ronald Maas
                                                              Zilog Z8000Anon
                                                          8086 does NOT have those addressing modesRicardo B
                                                            8086 does NOT have those addressing modesrwessel
                                                              8086 does NOT have those addressing modesDavid Hess
                                                                8086 does NOT have those addressing modesrwessel
                                                                  8086 does NOT have those addressing modesDavid Hess
                                                          8086 does NOT have those addressing modesDavid Hess
                                            Zilog Z8000rwessel
                                              Zilog Z8000Brett
                                                Zilog Z8000rwessel
                                                  Zilog Z8000Brett
                                                    Zilog Z8000rwessel
                                                      Zilog Z8000Brett
                                                    Zilog Z8000James
                                              Zilog Z8000Adrian
                                                PDP-11Michael S
                                                Zilog Z8000rwessel
                                              Zilog Z8000Ronald Maas
                                            Zilog Z8000Konrad Schwarz
                                              Zilog Z8000Adrian
                                                Zilog Z8000konrad.schwarz
                                                  Zilog Z8000Adrian
                                    It's hard to separateDavid Hess
                                  It's hard to separateDavid Hess
                                It's hard to separateAdrian
                                  It's hard to separateDavid Hess
                                It's hard to separategallier2
                                  It's hard to separatenone
                        It's hard to separaterwessel
                        It's hard to separateDavid Hess
                          It's hard to separaterwessel
                  It's hard to separateAdrian
                    It's hard to separaterwessel
                      It's hard to separateAdrian
                    It's hard to separateDavid Hess
                      It's hard to separatenone
                  Are segments so bad?Paul A. Clayton
                    Yes, they are terrible (NT)Anon
                    Are segments so bad?Adrian
                      Are segments so bad?Etienne
                        Are segments so bad?gallier2
                          Are segments so bad?Adrian
                            Are segments so bad?Adrian
                              Are segments so bad?Etienne
                        Are segments so bad?Adrian
                          Are segments so bad?gallier2
                      Are segments so bad?Anon3
                        Are segments so bad?Adrian
                          Are segments so bad?Brendan
                      Are segments so bad?Anon
                        Are segments so bad?Adrian
                          Are segments so bad?Jukka Larja
                            Are segments so bad?Brendan
                              Are segments so bad?Jukka Larja
                                Are segments so bad?Brendan
                                  Are segments so bad?Jukka Larja
                                  Are segments so bad?anon
                                    Are segments so bad?Brendan
                                      the world sucks worse than you're aware ofMichael S
                                        the world sucks worse than you're aware ofBrendan
                                        the world sucks worse than you're aware ofGabriele Svelto
                                      Are segments so bad?Jukka Larja
                                        Are segments so bad?Brendan
                                          Are segments so bad?Jukka Larja
                                            Are segments so bad?Brendan
                                              Are segments so bad?Anne O. Nymous
                                                Are segments so bad?Brendan
                                                  actor of around 200?Michael S
                                                  Not overcomitting leads to more OOMs, not lessGabriele Svelto
                                                    Not overcomitting leads to more OOMs, not lessBrendan
                                                      Not overcomitting leads to more OOMs, not lessGabriele Svelto
                                                        Not overcomitting leads to more OOMs, not lessAnon
                                                          Not overcomitting leads to more OOMs, not lessGabriele Svelto
                                                            Not overcomitting leads to more OOMs, not lessAnon
                                                              Not overcomitting leads to more OOMs, not lessGabriele Svelto
                                                                Not overcomitting leads to more OOMs, not lessAnon
                                                                  Not overcomitting leads to more OOMs, not lessGabriele Svelto
                                                        Not overcomitting leads to more OOMs, not lessMichael S
                                                          Not overcomitting leads to more OOMs, not lessGabriele Svelto
                                                            Not overcomitting leads to more OOMs, not lessMichael S
                                                              Not overcomitting leads to more OOMs, not lessJukka Larja
                                                        Not overcomitting leads to more OOMs, not lessJukka Larja
                                                          Thanks for the info (NT)Gabriele Svelto
                                                      Not overcomitting leads to more OOMs, not lessLinus Torvalds
                                                        OOM killer complainsAnon
                                                          OOM killer complainsanon
                                                        Not overcomitting leads to more OOMs, not lessBrendan
                                                          Not overcomitting leads to more OOMs, not lessLinus Torvalds
                                                            Not overcomitting leads to more OOMs, not lessLinus Torvalds
                                                              Not overcomitting leads to more OOMs, not lessDoug S
                                                                Not overcomitting leads to more OOMs, not lessDoug S
                                                Are segments so bad?rwessel
                                              Are segments so bad?Jukka Larja
                                                Are segments so bad?Brendan
                                                  Are segments so bad?Jukka Larja
                                                    Are segments so bad?Brendan
                                                      Are segments so bad?Brett
                                                      Are segments so bad?Jukka Larja
                                                  Are segments so bad?Gabriele Svelto
                                            Specifying cost of dropping pagesPaul A. Clayton
                                              Specifying cost of dropping pagesrwessel
                                                Specifying cost of dropping pagesGabriele Svelto
                                          Are segments so bad?anon
                                            Are segments so bad?Brendan
                                          Are segments so bad?Gabriele Svelto
                                            Are segments so bad?Brendan
                                              Are segments so bad?Gabriele Svelto
                                                Are segments so bad?Anon
                                                  Are segments so bad?Jukka Larja
                                                Are segments so bad?Etienne
                                                  Are segments so bad?Jukka Larja
                                                    Are segments so bad?Gabriele Svelto
                                                      Are segments so bad?Jukka Larja
                                                Are segments so bad?Brendan
                                                  Are segments so bad?Gabriele Svelto
                                                    Are segments so bad?Brendan
                                                      Are segments so bad?Jukka Larja
                                                        Are segments so bad?Brendan
                                                          Are segments so bad?Jukka Larja
                                                            Are segments so bad?Brendan
                                                              Are segments so bad?Jukka Larja
                                                                Are segments so bad?Brendan
                                                                  Are segments so bad?Brett
                                                                    Are segments so bad?Brett
                                                                  Are segments so bad?Gabriele Svelto
                                                                  Are segments so bad?Jukka Larja
                                                                    Are segments so bad?Brendan
                                                                      Are segments so bad?Jukka Larja
                                                                        Are segments so bad?Brendan
                                                                          Are segments so bad?Jukka Larja
                                                                            Are segments so bad?Brendan
                                                                              Are segments so bad?Jukka Larja
                                                      Are segments so bad?rwessel
                                                      Are segments so bad?Gabriele Svelto
                                                        Are segments so bad?Brendan
                                                          Are segments so bad?Gabriele Svelto
                                                            Are segments so bad?Anon
                                                              Are segments so bad?Gabriele Svelto
                                                            Are segments so bad?Brendan
                                                              Are segments so bad?Gabriele Svelto
                                                                Are segments so bad?Michael S
                                                                  Are segments so bad?Gabriele Svelto
                                                                    Are segments so bad?Jukka Larja
                                                                    Are segments so bad?Michael S
                                                                      Are segments so bad?Gabriele Svelto
                                                                Are segments so bad?Brendan
                                                                  Are segments so bad?Michael S
                                                                    Are segments so bad?Brendan
                                                                      Are segments so bad?Simon Farnsworth
                                                                        Are segments so bad?Anon
                                                                          Are segments so bad?Simon Farnsworth
                                                                      Are segments so bad?Michael S
                                                                  Are segments so bad?Gabriele Svelto
                                                                    Are segments so bad?Brendan
                                                                      Are segments so bad?Gabriele Svelto
                                                                        Are segments so bad?Brendan
                                                                          Are segments so bad?Jukka Larja
                                                                            Are segments so bad?Brendan
                                                                              Are segments so bad?Jukka Larja
                                                                                Are segments so bad?Brendan
                                                                                  Are segments so bad?Jukka Larja
                                                                                    Are segments so bad?Brendan
                                                                                      Are segments so bad?Jukka Larja
                                                                                        Are segments so bad?Brendan
                                                                                          Are segments so bad?Jukka Larja
                                                                                            Are segments so bad?Gabriele Svelto
                                                                                              Are segments so bad?Jukka Larja
                                                                                                DDS assets and MipMap chainsMontaray Jack
                                                                                      Are segments so bad?gallier2
                                                                                        Are segments so bad?Jukka Larja
                                                                                  Are segments so bad?Anne O. Nymous
                                                                            Are segments so bad?Anon
                                                                              Are segments so bad?Anne O. Nymous
                                                                                Are segments so bad?Anon
                                                                                  Are segments so bad?Anne O. Nymous
                                                                                    Are segments so bad?Anon
                                                                                      Are segments so bad?Etienne
                                                                              Are segments so bad?Gabriele Svelto
                                                                                Are segments so bad?Michael S
                                                                                Are segments so bad?Jukka Larja
                                                                                  Are segments so bad?Gabriele Svelto
                                                                                    Are segments so bad?Anon
                                                                                      Are segments so bad?Jukka Larja
                                                                                Are segments so bad?Anon
                                                                                  Are segments so bad?Gabriele Svelto
                                                                                    Are segments so bad?Anon
                                                                                      Are segments so bad?Gabriele Svelto
                                                                                        Are segments so bad?Anon
                                                                                          Are segments so bad?Gabriele Svelto
                                                                                            Are segments so bad?Anon
                                                                                              Are segments so bad?Gabriele Svelto
                                                                                                Are segments so bad?Anon3
                                                                                                Are segments so bad?Anon
                                                                                  Are segments so bad?Jukka Larja
                                                          Are segments so bad?Jukka Larja
                                Are segments so bad?Anne O. Nymous
                                  Are segments so bad?Jukka Larja
                            Are segments so bad?rwessel
                          Are segments so bad?Anne O. Nymous
                      Are segments so bad?Ricardo B
                        Are segments so bad?Adrian
                          Are segments so bad?Michael S
                            Are segments so bad?Adrian
                          Are segments so bad?Ricardo B
                            Are segments so bad?Anon3
                            Are segments so bad?Brendan
                      Are segments so bad?Paul A. Clayton
        No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)rainstared
          No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Foo_
            No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)dmcq
            changes in contextCarlie Coats
      No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)rainstar
        No nuances, just buggy code (was: related to Spinlock implementation and the Linux Scheduler)Montaray Jack
    Suggested reading for the authoranon
      Suggested reading for the authorab
        Looking at the other side (frequency scaling)Chester
          Looking at the other side (frequency scaling)Foo_
          Why spinlocks were usedFoo_
            Why spinlocks were usedJukka Larja
            Why spinlocks were usedSimon Cooke
            Why spinlocks were usedRizzo
          Looking at the other side (frequency scaling)ab
    Cross-platform codeGian-Carlo Pascutto
      Cross-platform codeMichael S
        Cross-platform codeGian-Carlo Pascutto
          Cross-platform codeMichael S
            Cross-platform codeNksingh
              Cross-platform codeMichael S
              SRW lock implementationMichael S
                SRW lock implementationNksingh
                  broken URL in Linux source codeMichael S
                    broken URL in Linux source codeTravis Downs
                      broken URL in Linux source codeMichael S
                        broken URL in Linux source codeTravis Downs
                  SRW lock implementation - url brokenMichael S
                    SRW lock implementation - url brokenTravis Downs
                      SRW lock implementation - url brokengpderetta
                        SRW lock implementation - url brokenTravis Downs
                      SRW lock implementation - url brokenLinus Torvalds
                        SRW lock implementation - url brokenTravis Downs
                          SRW lock implementation - url brokenLinus Torvalds
                    SRW lock implementation - url brokenKonrad Schwarz
                    SRW lock implementation - url brokennksingh
      Cross-platform codeLinus Torvalds