Wondering which processes are placed in your swap you can use this bash oneliner:
for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -n -r
You will see the swap usage of each process sorted by the highes amount of swap usage.
Please don't forget that swap usage of a process isn't an indicator for high memory usage of this process but for the frequency of access or activity of it. The kernel tries to avoid swapping pages which were recently accessed.
Also you should notice that the fact that memory pages allocated by a process are placed in swap does not mean that the pages are not in the main memory. Memory pages can be stored in the swap and in the main memory at the same time. This allows the system to release memory very quickly.
Posted by Claus-Theodor Riegg to makandra dev (2016-01-15 12:40)