1

I found many questions about avoid an app from going to swap, but I need to know a way to make an specific app (chromium) stay as much as possible at swap.

Is there any way to do that?

Basically whenever it is not focused, it should remain at swap.

1 Answers1

0

There's no generic way to do that, but there may be a way to do it on a specific Unix variant.

What would mostly work generically is to suspend the process. If the process is not suspended, then all the memory pages containing code and data that are accessed by whatever the process is doing are unlikely to be swapped out. A busy process like Chromium runs a lot of background tasks to ping servers, run timers triggered by Javascript, etc. Once the process is suspended, its memory remains unused and is likely to get progressively swapped out.

Under Linux, you can tune the swappiness of a specific group of processes. That doesn't guarantee that it'll end up all swapped out, and you'd better suspend it or some of its memory will get swapped in often, but if the kernel needs memory, pages from processes with a high swappiness are more likely to get swapped out. See Turning off swapping for only one process with cgroups?

I don't think there's any way to say “swap this specific page/area/process out now”.