kswapd0 occasionally pegs a single thread to 100%
by lol- from LinuxQuestions.org on (#6P3XS)
Since quite recently, the swap daemon has started randomly waking up and pegging a thread to 100%, with no way of making it go idle again. This is annoying as it makes my fans ramp up to 50% and massively decreases my battery life, from 6h to 3h. I am using the latest kernel, but LTS also seems to have this issue.
I have no swap, and plenty of RAM. My swappiness setting is 0
I read a few posts stating that some malware hides as kswapd0 and is installed through some SSH guest account vulnerability. However, I do not think this is the cause here:
bug manifestation
my system specs
(EDIT, oops the links won't embed properly, so I'll keep plain links instead)
As you can see, my system is under mild memory pressure. But it still has over fifteen gigabytes of available RAM, so the swap daemon shouldn't even try swapping things
UPDATE - further testing
I made a 1gb swapfile, (dd, chmod 600, mkswap, swapon), then opened a few Minecraft instances as a way to run out of system memory. Not a single byte was written to swap, whilst the system was completely out of RAM. My computer froze for a few seconds and the OOM killer destroyed all java processes. After this, swap was still unused but kswapd0 wasn't hogging my resources anymore. No swap being used before the OOM killer kicks in is probably also a bug.
I have no swap, and plenty of RAM. My swappiness setting is 0
I read a few posts stating that some malware hides as kswapd0 and is installed through some SSH guest account vulnerability. However, I do not think this is the cause here:
- I scanned my entire disk for a program named kswapd0, no results
- When the bug occurs, my network usage doesn't change
- "ps -o cmd fp [kswapd0 PID]" returns "CMD [kswapd0]" and no executable path, which is normal for kernel processes.
- I do have SSH, but with a strong password, not on the default port and with an aggressive fail2ban configuration.
bug manifestation
my system specs
(EDIT, oops the links won't embed properly, so I'll keep plain links instead)
As you can see, my system is under mild memory pressure. But it still has over fifteen gigabytes of available RAM, so the swap daemon shouldn't even try swapping things
UPDATE - further testing
I made a 1gb swapfile, (dd, chmod 600, mkswap, swapon), then opened a few Minecraft instances as a way to run out of system memory. Not a single byte was written to swap, whilst the system was completely out of RAM. My computer froze for a few seconds and the OOM killer destroyed all java processes. After this, swap was still unused but kswapd0 wasn't hogging my resources anymore. No swap being used before the OOM killer kicks in is probably also a bug.