11

I am a heavy VMware workstation 10.0.3 user, and as such I have 32GB RAM on my system. My only operating system is Arch Linux, using Unity for the desktop.

Usually when I have two virtual machines running with about 3GB RAM appointed to each, really often and at random intervals the whole system becomes unresponsive for a few seconds.

Running "top" at a terminal, the culprit seems to be the command khugepaged, which runs while the system is unresponsive at 100% CPU and then dissapears.

Is there any way to avoid this? I have googled about khugepaged, but I only seem to find ancient posts from 2011 or unanswered questions.

These are my full system specs:

  • CPU: Intel i5 [email protected]
  • 32GB Corsair Vengeance RAM@2400MHz
  • M/B ASrock Z87 Pro 4
terdon
  • 234,489
  • 66
  • 447
  • 667
Angelos Kyritsis
  • 111
  • 1
  • 1
  • 3
  • What are your swap settings like? That kind of hang is often related to swap usage. Can you check swap next time it hangs? Does it only hang when actively swapping? – terdon Oct 13 '14 at 16:13
  • Why should it swap with 32GB RAM? It goes nowhere near exchausting the physical RAM. I have a small 1GB swap partition - since it is on an SSD and I didn't want to waste real estate. I haven't changed swappiness, I guess it is at the default value. – Angelos Kyritsis Oct 13 '14 at 16:19
  • Well, arch has the default [set to 60](https://wiki.archlinux.org/index.php/Swap#Swappiness) which means it will start swapping long before the RAM is exhausted. I'm not saying it's swap for sure but it does seem likely. Try setting a lower value. – terdon Oct 13 '14 at 16:44
  • Ok, I have set it to 5. I will let you know if it made a difference. – Angelos Kyritsis Oct 13 '14 at 16:54
  • http://unix.stackexchange.com/questions/161858/arch-linux-becomes-unresponsive-from-khugepaged – mazgalici Jan 05 '15 at 22:21
  • @AngelosKyritsis: so, did it? – mitchus Sep 06 '16 at 13:23
  • @mitchus Went back to Ubuntu a while ago, but as far as I can remember, it didn't help. – Angelos Kyritsis Sep 06 '16 at 20:20

2 Answers2

15

I have similar problem on Ubuntu. The workaround I use is:

echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo 0 > /sys/kernel/mm/transparent_hugepage/khugepaged/defrag

The source of the workaround is in a Fedora bug report “khugepaged eating 100%CPU”. The bug was never fixed.

This is less drastic then disabling entire transparent_hugepage support. The detailed explanation of what the command does can be found in the documentation of transparent hugepage support.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Pawel Jasinski
  • 291
  • 2
  • 5
  • `echo never | sudo tee /sys/kernel/mm/transparent_hugepage/defrag`; `echo 0 | sudo tee /sys/kernel/mm/transparent_hugepage/khugepaged/defrag` – Treviño Nov 29 '16 at 11:48
  • @Treviño, may I ask what the difference is to what the author of the answer is proposing: why should one use `| sudo tee` in stead of `>`? – Joma Dec 01 '16 at 12:01
  • 1
    @Joma the `sudo echo $value > output` doesn't work in Ubuntu, you need to use the `tee` trick, or do it from `sudo -s` shell. – Treviño Dec 05 '16 at 22:41
  • 1
    Seriously, I love you for that, @pawel-jasinski – the first time in 5 years that I can actually WORK with VMware without that it regularly freezes both host and guest OS. – Simon A. Eugster Jul 27 '18 at 16:13
  • 1
    @Joma The first command has to be run from a root shell. With `sudo echo X > Y`, only `echo X` is run as root but `> Y` (forward output into a file) is not. – Simon A. Eugster Jul 27 '18 at 16:15
  • After an archlinux update some weeks ago this problem appeared for me. Every time I come back to my machine (sitting idle with mainly just firefox and thunderbird running), the fan is on top speed and khugepaged sits on one cpu 100%. I don't use vmware. The workaround presented seems to work, but I'm not sure about the downsides. Will this fragment my memory allocations over time? Sounds bad. – molecular Feb 06 '23 at 10:12
1

khugepaged might be the problem, try the following:

echo never > /sys/kernel/mm/transparent_hugepage/enabled

this helped me to resolve this issue on recent arch linux...

Archemar
  • 31,183
  • 18
  • 69
  • 104
ArchUser
  • 21
  • 1
  • 4
    Hi and welcome to the site! We expect answers to be a bit more detailed here. Could you perhaps [edit] your answer and explain what the command you suggests does and how it would help? – terdon Jan 14 '15 at 12:37
  • 1
    @ArchUser also if you are not sure this is the solution please post as a comment. – vfbsilva Jan 14 '15 at 12:44