Linux scheduler bug got you down? Here’s a fast fix
Earlier this month, according to a lecture and paper delivered at the EuroSys ’16 conference in London, the Linux kernel scheduler has deficits that stop a multicore system from making proper use of all cores for heavily multithreaded loads.
However, now a patch is available in a script provided by a third party for those who are running applications that might be affected and do not wish to wait for a solution from the kernel team.
Titled “The Linux Scheduler: a Decade of Wasted Cores,” the paper was authored by a sextet of researchers from the University of British Columbia and four other institutions. According to the paper, there are four bugs in the kernel scheduler that makes some CPU cores to stay idle even when runnable threads are waiting to be dispatched to a core.
“Resulting performance degradations are in the range 13-24% for typical Linux workloads,” the researchers say, “and reach 138× in some corner cases.”
The desktop users are not affected by the bug. According to a discussion thread on Hacker News, the issue includes complications that rise when using the Linux scheduler on multiprocessor systems. In certain circumstances, the algorithm used by the scheduler to balance the load across cores flops. For example, a thread that was asleep in the past is woken up on an overloaded core, when other cores are not in use.
The paper mentions one test with apps written in the R language that suggests how the issue might rise when doing math and statistical work in multicore Linux environments.
The researchers say that such bugs don’t always proclaim their presence with a crash or a hang, but rather via ruined performance, so they are not always noticeable.
It looks like the patches suggested by the researchers have not yet been submitted to the Linux kernel maintainers. However, for those who are running heavy multicore loads on Ubuntu can apply the patches instantly with a script available on GitHub. The script gets the dependencies required to build the kernel, puts on the required patches, and gives the choice to either install the kernel then and there or develop it into a .deb package that can be used elsewhere.