Oh wow, I have been experiencing this for a while as well (100% cpu when launching facebook, especially messenger) and had no time to troubleshoot it. @sotnas could you please share the steps you followed to solve it? I would be very grateful!
Hi! I just created a swapfile. Note that I didn’t set a swap partition and I wasn’t being capable of partitioning my HDD to create one. So I created a swapfile.
Here are the steps I followed:
Log in as root
# dd if=/dev/zero of=/mnt/swapfile bs=1024 count=2097152
# chmod 600 /mnt/swapfile
# mkswap /mnt/swapfile
# swapon /mnt/swapfile
/etc/fstab, add the following line:
/mnt/swapfile swap swap defaults 0 0
# swapon -s
is there a reason why the kernel is swapping? why is there low memory? 1k open tabs? a memory leak?
I really don’t know. But looking around the web, I found people saying that there were problems in systems with more than enough RAM. I also found articles saying that we should always use swap even if the system has enough ram. Or other cases stated kernel issues.
I had this problem since I installed Chakra. Always thought that this was due to the CPU being antique. After creating the swapfile, I start to set up swapiness to 10. And it did swap regularly (200 or 300 Mb). Afterwards I reset swapiness to 1 and, for example, I turned my PC on at around 9:00 and right now I have swap at 512,0 kiB.
what for a browser are you using? falkon or a other webkit based one?
I use Firefox or Chromium. I have Falkon installed but in facebook it got a bit slower.
I haven’t used Falkon ever after creating the swapfile but i’ll give it a try.
Is a good practice to have a swap partition or file, I would say Is a must, I even with 16GB on my system I will use the swap sometime with heavy load.
Without swap, is enough that you reach the maximum RAM available once that your system start freezing.
As I said I didn’t set up a swap partition on Chakra installation. So, from what I read of the searching I made, I ended up knowing that kswapd was looking for the swap partition (almost) endlessly when there was nothing to be found, hence the 100% usage of one of the cores.
Does my message qualifies as a tutorial? It’s not my creation, I should mention it again.
a swap wasn’t necessary in the past and there where no negative drawback if enough ram available.
check your swap from time to time if the amount is growing because the swap must be empty if enough ram available except leftover.
[tom@donar ~]$ LC_ALL=C free total used free shared buff/cache available Mem: 2.9Gi 528Mi 1.8Gi 105Mi 579Mi 2.1Gi Swap: 2.0Gi 0B 2.0Gi Total: 4.9Gi 528Mi 3.9Gi
i found this on the german arch forum and it describes your problem:
this pinguin thought sddm is the reason. unfortunately was this threat not a proper trouble shoot.
if his opinion correct the should be avoid sddm the solution.
how to avoid sddm:
[nfs@nfs-pc ~]$ LC_ALL=C free total used free shared buff/cache available Mem: 2989 1147 923 112 919 1574 Swap: 2047 253 1794
I don’t think that fellow had the same problem I had, originaly.
If I understood correctly, he had a swap partition set up and his swap memory keeps growing and kswapd0 uses too much CPU, aswell.
I didn’t have the swap partition nor a swapfile. kswapd0 was trying to swap but could not find the partition nor the file. After creating a swapfile I never had the same issue.
Nevertheless I will try to disable sddm and set swapiness to 0 to see what happens.
swapiness 0 will hide if sddm was the reason.
do you know when this problem first time occurs? with kernel?
Ever since I installed Chakra. When I was working I would avoid to browse facebook or at least avoided to look through too many pictures or too much scrolling.
RAM consumption would build up and the swap thing would kick in, with kswapd0 taking one of the cores on his own.
How shall I deactivate the swapfile? Just by deleting it?
swaping must be possible otherwise you can’t see if it work as expected
what a pity.
how many kernel versions are in your pacman cache?
swapoff -a and opened every tab I could, both in Chromium and in Firefox.
The pc got really slow. Still, with some patience, I opened Ksysguard and kept the terminal open.
Things got nasty with the CPU at full speed and lots delay.
swapon -a and things went from hell to heaven in a matter of seconds.
How did things turn out for you? Have you solved the problem?
Well, I launched facebook today to test for this and I can’t replicate. Lots of updates happened in the meantime, so I can’t be sure what might have fixed it. Thanks for asking!
If I can replicate in the near future I’ll let try your solution and let you know. I do however have a swap partition, so I’m not sure if this will help.
An old and already lengthily discussed problem seems to be back again. Searching für “100 % CPU” brings up quite a few post. And about a year ago I started this one.
For me everything seemed to work fine after upgrading my hardware. Instead of 6 GB RAM I’ve got 10 GB now. Swap partition was extended to 20 GB and resides on a SSD now. Every thing went smoothly after these changes, unless I came close to the capacity of the swap partition.
But after the last big update a week ago I experience occasional freezes again. These usually happen, as far as I can tell, when I use Firefox, mostly navigation youtube. Checking memory usage after regaining control of the system I saw that RAM was almost used up and the swap partition about 50%. But I do not know memory state during the freeze since I could not even change to a TTY.
Two more things to mention:
- swappiness is 10
- I’m still using kernel 4.18.12-1 since the update to 4.19.12 rendered my system unbootable.
@king.knut wow, 10 + 10 GB of memory use for firefox? nah… impossible, I’m using FF heavily and I don’t exceed 2B of RAM.
Only when rendering with kdenlive I will reach my RAM limits of 16GB, but only in that case.
There is something that does not work on your pc, you have to check that.
ksysguard is always open and I regularly check CPU and memory use of various programs.
Not FF is eating up my memory. With about 80 to 90 tabs in 4 windows FF is using less than 2 GB. Much more memory hungry is Dolphin. About fifteen tabs in 10 windows use more than 3.5 GB. That is unbelievable. And it is getting more and more each time I wake my system up after hibernating it. Already filed a bug report.
Apart from the dolphin issue my system ran smooth until the last update. And you are right, editing and also watching movies makes it get close to the limits. But that did not happen often.
I only wonder what. Dolphin?
Here the big memory consumers:
- Dolphin 3.5 GB
- FF 1.9 GB
- Rambox 900 MB
- Choqok 230 MB
- Latte-Dock 150 MB
- Libreoffice 140 MB
And these are also the programs that use most CPU time, but each only in between 1 and max. 5 percent.
In the moment - after waking the system up twice or three times - memory us is 8GB/9.6GB and swap 3.1GB/20GB.
is a amount growing while work?
3,5 GB for dolphin is imo a big value but it shouldn’t force your machine to swap