15

Torvalds' Comments on Linux Scheduler Woes: “Pure Garbage”

 4 years ago
source link: https://www.phoronix.com/scan.php?page=news_item&%3Bpx=Torvalds-On-Scheduler-Woes
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Torvalds' Comments On Linux Scheduler Woes: "Pure Garbage"

Written byMichael Larabel inLinux Kernel on 5 January 2020 at 07:37 AM EST.22 Comments

i2aIvee.jpg!web

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.

22 Comments


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK