Swap usage limit

Sets a total process limit (memory and swap usage) for the whole job. The default is no limit. Exceeding the limit causes the job to terminate.


Job syntax (bsub) Queue syntax (lsb.queues) Format/Default Units
-v swap_limit SWAPLIMIT=limit integer KB

By default, the limit is specified in KB. Use the LSF_UNIT_FOR_LIMITS parameter in the lsf.conf file to specify a larger unit for the limit (MB, GB, TB, PB, or EB).

This limit applies to the whole job, no matter how many processes the job may contain.

By default, LSF collects both memory and swap usage through PIM:
  • If the EGO_PIM_SWAP_REPORT=n parameter is set in the lsf.conf file (this is the default), swap usage is virtual memory (VSZ) of the entire job process.
  • If the EGO_PIM_SWAP_REPORT=y parameter is set in the lsf.conf file, the resident set size (RSS) is subtracted from the virtual memory usage. RSS is the portion of memory occupied by a process that is held in main memory. Swap usage is collected as the VSZ - RSS.
For example, if a job process allocates memory as follows,
malloc(p, 200MB); 
memset(p, 150MB); 
then bjobs -l shows SWAP as either 200 MB if EGO_PIM_SWAP_REPORT=n, or 50 MB if EGO_PIM_SWAP_REPORT=y.

From ps or top output, 200 MB is the virtual memory (VSZ) and 150 MB is the resident set size (RSS).

On Linux, if you check the output of Linux utility free or monitor the output of vmstat, there is actually no swap usage at all. In fact, the meaning of swap usage in Linux is the physical space usage of the underlining swap device, which is usually a block device.

If memory enforcement through the Linux cgroup memory subsystem is enabled with the LSF_LINUX_CGROUP_ACCT=y parameter in the lsf.conf file, LSF uses the cgroup memory subsystem to collect memory and swap usage of all processes in a job.

For example, if you enable the LSF_LINUX_CGROUP_ACCT=y parameter, and run the same program,
malloc(p, 200MB); 
memset(p, 150MB); 

The bjobs -l command shows SWAP as the swap usage of all currently running processes in a job collected by the cgroup memory subsystem.