If your Linux machine is configured with several swap partitions, the default trend is to use of one partition at a time. Once one swap partition has been full the next will be used. This is not always the best method for performance, since when a new process needs to be swapped to disk it may be forced to wait until another process is swapped out.

For instance, if there are two swap partitions specified in /etc/fstab it will look something like this:

/dev/sda2    swap     swap    defaults           0 0
/dev/sda3 swap swap defaults 0 0

Change the mount options section from ”defaults” to ”pri=0” :

/dev/sda2    swap      swap    pri=0           0 0
/dev/sda3 swap swap pri=0 0 0

If you want to do this in a live system, then swapoff and swapon with “-p 0” option for each swap device – one by one. Once this has been done the system will be able to access any of the designated swap partitions independently of the others. This can increase the swap performance of a machine which is regularly swapping memory to disk. However it is important to bear in mind that in most situations a machine should not make heavy use of swap partitions.
Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like
Read More

Disabling TLS 1.0 on nginx web servers

Disable TLS 1.0 and enable higher versions of TLS in nginx. To disable TLS 1.0 on nginx webserver installations, edit the "ssl_protocols" directive in your nginx.conf, where the TLS server directives are listed and remove TLSv1.
Read More

What is /proc/slabinfo?

/proc/slabinfo gives information about memory usage on the slab level. Linux kernels uses slab pools to manage memory…