I am using Debian sid, hard drive formatted with ext4, running on linux 3.1
I remember on previous linux versions (maybe before 3.0), if I run out of memory, and swap is not enabled, programs will usually crash. This is perfect for my environment: simple web browsing with no critical operations. That is, if I accidentally run across a bad website which uses up too much memory, it just crashes without rendering my terminal unusable.
But in my current setup, the computer hangs with violent I/O throughput in the background. iotop reveals kswapd0 to be the culprit, which means it is due to swapping. After using swapon -s
to determine any swaps that were enabled, I used swapoff -a
to disable all swaps and swapon -s
again to confirm that all swaps were disabled.
Then I tried maximizing my memory usage again. Alas, the behavior I expected didn't happen. Instead, kswapd0 tries over and over to swap out the RAM and fails as there is no swap space. Because it never gives up, my computer is locked in eternal I/O heavy freeze, bad for my disk's health.
Am I doing something wrong in trying to swapoff -a
? Why is the behavior different than what it used to be (probably pre-3.0 times)?
swapoff -a
itself, if there was stuff in the swap, will generate a lot of I/O (and can result in processes getting killed if there is not enough real RAM availabe). Are you sure it's not theswapoff -a
that caused the I/O "storm"? – Mat Nov 15 '11 at 11:40fstab
line about swap. Try if the behavior is the same. – enzotib Nov 15 '11 at 11:48swapoff -a
should disable swap permanently, meaning it should stay disabled after next reboot. I confirmed this. Yet, I/O "storm" still happens during the session after next reboot. For the record, I/O "storm" didn't happen at the moment I didswapoff -a
because swap was 0 at that time. – syockit Nov 15 '11 at 11:48swapoff -a
is not permanent. – Mat Nov 15 '11 at 11:51kswapd0
does work always and even without any dedicated swap partion/file. Because your RAM contains mapped files (e.g. the executrables binaries of programs running), which have copies in the fs. Hence in "almost-no-ram-left situations", even without any swap-partition etc. Linuxkswapd0
will temporarilry make room in the ram by removing those mapper files copies in RAM. Thinking that any bug or forgotten setting to disabled swap-partition is an wrong assumption to start with – humanityANDpeace Nov 23 '18 at 18:20