How much paging space is needed?
You can use these commands to determine how much paging space is being used on your system:
- Displays the amount of free and used memory in the system.
- swapon -s
- Displays swap usage summary by device. Equivalent to
To determine how much paging space is needed, it is recommended that the paging space should be double the amount of physical memory. So if a system has 1 gigabyte of memory, the total paging space should be 2 gigabytes (although the 2 gigabytes can be separated onto more than one disk).
On Linux you should consider the following recommendations when configuring your paging space:
- Use the disk or disks that are least utilized.
- Do not allocate more than one paging page logical volume for each physical disk.
- Avoid sharing the same disk with logical volumes.
- Make all paging spaces the same size if possible.
- Make all paging spaces have the same priority (man swapon on how to do that).
To make paging space available to your system, you must add and activate the paging space. The total amount of paging space is often determined by trial and error. One commonly used guideline is to double the RAM size and use that figure as a paging space target.
- To list your current paging space, type:
- To add paging space, type:
- Add device to /etc/fstab
- To activate paging space, type
When is a system thrashing? When page space becomes depleted, the operating system attempts to release resources by first warning processes to release paging space and then by killing the processes. Use the oom_adj and oom_score tools in /proc/PID to set the thresholds at which this activity occurs.
For information and recommendations for changing values for your configuration, see the documentation of your Linux distribution.