kslowd000 and friends |
2011-04-07
|
Ever since upgrading to Fedora 14 my desktop felt sluggish. It was more than the typical boiling frog kind of sluggishness, where you get the feeling everything's snappy just after you bought a new fancy computer and install it freshly with a recent OS, and over time performance slowly degrades until you wonder why computers are always so slow. Sure, it looks like Evolution, after a round of improvements in memory management, has gone back to being a memory hog. But this time, it was more. It would go through short phases of unresponsiveness and then come back. Load would be consistently around 1 or more, but for no apparent reason at all.
After a while watching top, I noticed a process called kslowd[xxx] jumping up and down in the top output regularly. The k says it's a kernel process. No idea what it is. Googling isn't very helpful to learn what it actually is, but it did put me on the trail because there are huge amounts of posts on sites and mailing lists about this process eating CPU time and slowing down the computer.
After a bunch of reading some post suggested it might be this patch by Dave Airlie, a name I recognize, to the kernel. I took the Fedora kernel src.rpm, spent a few minutes getting acquainted with Fedora's kernel spec layout de l'année, integrated the patch, rebooted, and voila. No more kslowd000 eating all my CPU.
I recently found this workaround which I'll try next time the kernel gets upgraded.
That still doesn't tell me what that kernel process is supposed to be doing (anyone up for a mandatory rule of having man pages for kernel processes too ?), so feel free to comment!
These “kslowd†threads are actually part of the kernel’s so-called “slow work†thread pool. This is used for certain jobs which take a long time to run — that are “slow†— and can’t be run in the course of regular kernel execution, because they’d hold other things up and increase latency.
There’s a LWN article that gives an introduction: http://lwn.net/Articles/329464/
Comment by Calvin Walton — 2011-04-07 @ 21:17
I’m having the same problem on ubuntu maverick and natty, still not fixed! Note that there is an easy workaround:
echo N > /sys/module/drm_kms_helper/parameters/poll
Comment by Xavier Claessens — 2011-04-07 @ 21:18
Since you ask so nicely, kslowd processes are used to implement the slow work mechanism – http://lwn.net/Articles/329464/ – an in-kernel thread pool for things that take a while to run.
The slow work in question that you’re seeing eat CPU is the polling for newly present monitors on your system; given that it’s switcheroo related, I would guess that you have a desktop with both Intel graphics and something else (nVidia, AMD). One of the GPUs is switched off, but without the patch, the Linux kernel still polls the GPU’s connectors in case a monitor has appeared that it can use. Of course, as the GPU is off, the polls fail.
Comment by Simon Farnsworth — 2011-04-07 @ 22:00
https://lwn.net/Articles/329464/
Contemporary kernels should have all this converted to workqueues I beleive:
http://article.gmane.org/gmane.linux.kernel/1012084
Comment by Harvey — 2011-04-07 @ 22:31