1

I have an SSD and 8GB memory, and no swap partition. My normal use never ever needs more than 3-4GB. However from time to time I observed that some memory-leaking programs can still freeze the system that it becomes immediately unusable. I noticed that a process kswapd is then running.

  1. What is kswapd likely doing without swap space? I don't want the system to swap, neither to a swap partition nor to a swap file.

In my usage habits I would consider any process that causes full RAM as harmful and would prefer the process to be automatically killed rather than that swapping is necessary.

  1. Is there a way to disable swapping completely (not just reduce swappiness) and force the Kernel to kill processes that take eg. 50% of RAM?
1

Note that ps (on my Ubuntu 14.04.2) shows "kswapd" as:

root        39     2  0 Mar23 ?        00:03:27 [kswapd0]  

The "[]" surrounding the process name indicates that kswapd0 is a portion of the kernel code that, for system convenience, is running as a process.

kswapd not only manages swapping, it also manages the flow of memory among buffers, cache, available, etc.

Having NO swap space will prevent swapping. Without swapping, when a RAM hog allocates all the memory, the next process to request RAM (hog or not) will get an OOM (Out Of Memory) error and be stopped. Note that it is not necessarily the memory hog that will be killed, just the first process to request RAM when there is none (or there are no memory blocks bigger than the request)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.