Skip to main content
edited tags
Link
Gilles 'SO- stop being evil'
  • 838.7k
  • 198
  • 1.8k
  • 2.2k
Tweeted twitter.com/StackUnix/status/852581785787670528
Source Link
AdamW
  • 61
  • 2

Is sending the SIGKILL to a swapped process unswapping it before killing?

Suppose that I want to terminate a process on Linux machine with swap (which is actually a zram). The swap is a half of RAM's size. There is only 10% of free space in RAM and the swap is almost full too.

The process is using only 2% of RAM but about 90% of swap.

Doing a soft close (SIGTERM) and allowing the process to catch the signal and close by itself would cause unswapping all swapped mappings, but there is no enough free RAM to fit the whole process.

Because of that it may be better to kill the process with SIGKILL but I'm still afraid that OOM-killer would kill other processes or even whole X session or init due to run out of memory.

So is sending a kill signal make kernel to move swapped parts of process into physical memory? (What should I expect? Does it depend on kernel's version?)

If so, what to do in such case? The goal is to terminate the process without touching the rest (there are other important processes running).

Moreover how to kill it correctly when it's not a one process but a processes' tree and I can't let the application terminate by itself?