Torvalds' Comments On Linux Scheduler Woes: "Pure Garbage"

Written by Michael Larabel in Linux Kernel on 5 January 2020 at 07:37 AM EST. 89 Comments
As you may recall a few days ago there was the information on the Linux kernel scheduler causing issues for Google Stadia game developers. The scheduler was to blame and in particular Linux's spinlocks. Linus Torvalds has now commented on the matter.

In a mailing list discussion on the reported Linux kernel troubles, Linus Torvalds wrote, "The whole post seems to be just wrong, and is measuring something completely different than what the author thinks and claims it is measuring. First off, spinlocks can only be used if you actually know you're not being scheduled while using them...It basically reads the time before releasing the lock, and then it reads it after acquiring the lock again, and claims that the time difference is the time when no lock was held. Which is just inane and pointless and completely wrong. That's pure garbage."

Linus went on to add, "So what's the fix for this? Use a lock where you tell the system that you're waiting for the lock, and where the unlocking thread will let you know when it's done, so that the scheduler can actually work with you, instead of (randomly) working against you...I repeat: do not use spinlocks in user space, unless you actually know what you're doing. And be aware that the likelihood that you know what you are doing is basically nil." See his post in full for a lot more interesting technical details.

In another post he goes on to argue the game developer's locking was fundamentally wrong. In other words, the Linux kernel isn't to blame at least in full, from the perspective of Linus Torvalds. But as shown in other instances, there's still room for improvement with the Linux kernel's scheduler code.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via

Popular News This Week