Tunable Kernel Parameters

Table Of Contents
Memory Paging Subsystem
Overview of Memory Paging Parameters
Chapter 7
45
File System Swap
In addition to swap space on individual devices, swap space can also be created in
existing mounted file systems. This file system swap is somewhat slower than device
swap because it must be handled by reading from and writing to open files rather than
transferring data directly between the operating system and the disk device. nswapfs is
the file system swap counterpart to nswapdev and defines how many locally mounted file
systems can be configured system-wide to support file system swap. Like nswapdev,
nswapfs should be set to match the actual number of file systems that are normally
mounted and intended to be used for file system swap (about nswapfs times 300 bytes of
kernel space is required for data structure storage). Only hard disk read/write file
systems can be used for file system swap.
A second configurable parameter, allocate_fs_swapmap can be set to enable or disable
the allocation of swap space at the time swapon() is called rather than waiting to
allocate space using malloc(). Preallocating space ensures the unconditional
availability of file system swap space when malloc() is called (otherwise a
file-system-full error could occur in some circumstances). Preallocation of file system
swap space when swapon() is called is commonly used when high availability is
important, but it does prevent other processes from using any resources that are not
being use by the process that reserved them.
Pseudo-Swap
Memory allocation is normally based on the availability of virtual memory (swap space
available on disks and file systems). Total available (swappable) memory is the same as
total swap space. However, on large systems with massive amounts of installed RAM
this can lead to inefficiencies.
Consider a system, for example, that contains 200 MB of RAM, and has 1 GB of swap on
the root disk. It is inappropriate to limit such a system running in single-user mode with
only the root disk mounted to only 1 GB of memory space when the kernel occupies only
10% or less of the available system RAM. By allowing the use of pseudo-swap, any
unused RAM can also be allocated for use by the swap system, allowing larger, more
demanding processes to run. On a workstation with 100 or 200 MB of swap on the root
device and 16 MB of RAM, the advantage of this capability is much less significant.
swapmem_on is used to enable or disable the allocation of pseudo-swap space in system
RAM.
Additional Information
“Memory Paging Parameter Summary” on page 42