The Solaris environment is a demand paged virtual memory system. As the system runs, pages are brought into memory as needed. When memory becomes occupied above a certain threshold and demand for memory continues, paging begins. Paging goes through several levels that are controlled by certain variables.
The general paging algorithm is as follows:
A memory deficit is noticed. The page scanner thread runs and begins to walk through memory. A two-step algorithm is employed:
A page is marked as unused.
If still unused after a time interval, the page is viewed as a subject for reclaim.
If the page has been modified, a request is made to the pageout thread to schedule the page for I/O and the scanner continues looking at memory. Pageout causes the page to be written to the page's backing store and placed on the free list. When scanning memory, no distinction is made as to the origin of the page. It may have come from a data file, or it might represent a page from an executable's text, data, or stack.
As memory pressure on the system increases, the algorithm becomes more aggressive in the pages it will consider as candidates for reclamation and in how frequently the paging algorithm runs. (See "fastscan" and "slowscan" for more information.) As available memory falls between the range lotsfree and minfree, the system will linearly increase the amount of memory scanned in each invocation of the pageout thread from the value specified by slowscan to the value specified by fastscan. The system uses the desfree variable to control a number of decisions about resource usage and behavior.
The system also attempts to constrain itself to use not more than 4% of one CPU for pageout operations. The algorithm is to look through some amount of memory between slowscan and fastscan, and stop when one of the following occurs:
Enough pages have been found to satisfy the memory shortfall.
The planned number of pages have been looked at.
Too much time has elapsed.
If a memory shortfall is still present when pageout finishes its scan, another scan is scheduled for 1/4 second in the future.
We recommend that all tuning of the VM system be removed from /etc/system. Run with the default settings and determine if it is necessary to adjust any of these parameters. Do not enable priority_paging or adjust cachefree. These are no longer needed, although still present in the kernel. Manipulating them will almost certainly result in performance degradation when the page scanner runs.
Beginning in the Solaris 7 5/99 release, dynamic reconfiguration (DR) for CPU and memory is supported. The behavior of the system in a DR operation involving the addition or deletion of memory is to recalculate values for the relevant parameters unless the parameter has been explicitly set in /etc/system. In that case, the value specified in /etc/system is used unless a constraint on the value of the variable has been violated, in which case the value is reset.
Initial trigger for system paging to begin. When this threshold is crossed, the page scanner wakes up to begin looking for memory pages to reclaim.
Unsigned long
The greater of 1/64th of physical memory or 512 Kbytes
The minimum value is 512 Kbytes or 1/64th of physical memory, whichever is greater, expressed as pages using the page size returned by getpagesize(3C).
The maximum is the number of physical memory pages. The maximum value should be no more than 30% of physical memory. The system does no enforcement of this range other than that described in the Validation section.
Pages
Yes, but dynamic changes are lost if a memory based DR operation occurs.
If lotsfree is greater than the amount of physical memory, the value is reset to the default.
The relationship of cachefree is greater than or equal to lotsfree, which is greater than desfree, which is greater than minfree, must be maintained at all times.
When demand for pages is subject to sudden sharp spikes, the memory algorithm might not be able to keep up with demand. One way to work around this problem is to start reclaiming memory at an earlier time. This solution gives the paging system some additional margin.
A rule of thumb is to set this parameter to 2 times what the system needs to allocate in a few seconds. This parameter is workload dependent: a DBMS server can probably work fine with the default settings, but a system doing heavy file system I/O might need to adjust this parameter.
For systems with relatively static workloads and large amounts of memory, adjust this value downwards. The minimum acceptable value is 512 Kbytes expressed as pages using the page size returned by getpagesize(3C).
Unstable
Amount of memory desired to be free at all times on the system.
Unsigned integer
lotsfree / 2
The minimum value is 256 Kbytes or 1/128th of physical memory, whichever is greater, expressed as pages using the page size returned by getpagesize(3C).
The maximum is the number of physical memory pages. The maximum value should be no more than 15% of physical memory. The system does no enforcement of this range other than that described in the Validation section.
Pages
Yes, unless dynamic reconfiguration operations that add or delete memory occur. At that point, the value is reset to whatever was provided in the /etc/system file or was calculated from the new physical memory value.
If desfree is greater than lotsfree, desfree is set to lotsfree / 2. No message is displayed.
The relationship of cachefree is greater than or equal to lotsfree, which is greater than desfree, which is greater than minfree, should be maintained at all times.
Several side effects can arise from increasing the value of this variable. When the new value nears or exceeds the amount of available memory on the system:
Asynchronous I/O requests are not processed unless available memory exceeds desfree. Increasing the value of desfree can result in rejection of requests that otherwise would succeed.
NFS Version 3 asynchronous writes are executed as synchronous writes.
The swapper is awakened earlier, and the behavior of the swapper is biased towards more aggressive actions.
The system might not prefault as many executable pages into the system. This side effect results in applications potentially running slower than they otherwise would.
For systems with relatively static workloads and large amounts of memory, adjust this value downwards. The minimum acceptable value is 256 Kbytes expressed as pages using the page size returned by getpagesize(3C).
Unstable
Minimum acceptable memory level. When memory drops below this number, the system biases allocations toward those necessary to successfully complete pageout operations or to swap processes completely out of memory, and either denies or blocks other allocation requests.
Unsigned integer
desfree / 2
The minimum value is 128 kbytes or 1/256th of physical memory, whichever is greater, expressed as pages using the page size returned by getpagesize(3C).
The maximum is the number of physical memory pages. The maximum value should be no more than 7.5% of physical memory. The system does no enforcement of this range other than that described in the Validation section.
Pages
Yes, unless dynamic reconfiguration operations that add or delete memory occur. At that point, the value is reset to whatever was provided in the /etc/system file or was calculated from the new physical memory value.
If minfree is greater than desfree, minfree is set to desfree / 2. No message is displayed.
The relationship of cachefree is greater than or equal to lotsfree, which is greater than desfree, which is greater than minfree should be maintained at all times.
The default value is generally adequate. For systems with relatively static workloads and large amounts of memory, adjust this value downwards. The minimum acceptable value is 128 Kbytes expressed as pages using the page size returned by getpagesize(3C).
Unstable
Memory level at which blocking memory allocation requests are put to sleep, even if the memory is sufficient to satisfy the request.
Unsigned integer
minfree
The minimum value is 128 Kbytes or 1/256th of physical memory, whichever is greater, expressed as pages using the page size returned by getpagesize(3C).
The maximum is the number of physical memory pages. The maximum value should be no more than 4% of physical memory. The system does no enforcement of this range other than that described in the Validation section.
Pages
Yes, unless dynamic reconfiguration operations that add or delete memory occur. At that point, the value is reset to whatever was provided in the /etc/system file or was calculated from the new physical memory value.
If throttlefree is greater than desfree, throttlefree is set to minfree. No message is displayed.
The relationship of cachefree is greater than or equal to lotsfree, which is greater than desfree, which is greater than minfree, should be maintained at all times.
The default value is generally adequate. For systems with relatively static workloads and large amounts of memory, adjust this value downwards. The minimum acceptable value is 128 Kbytes expressed as pages using the page size returned by getpagesize(3C).
Unstable
Number of pages reserved for the exclusive use of the pageout or scheduler threads. When available memory is less than this value, non-blocking allocations are denied for any processes other than pageout or the scheduler. Pageout needs to have a small pool of memory for its use so it can allocate the data structures necessary to do the I/O for writing a page to its backing store. This variable was introduced in the Solaris 2.6 release to ensure that the system would be able to perform a pageout operation in the face of the most severe memory shortage.
Unsigned integer
throttlefree / 2
The minimum value is 64 Kbytes or 1/512th of physical memory, whichever is greater, expressed as pages using the page size returned by getpagesize(3C).
The maximum is the number of physical memory pages. The maximum value should be no more than 2% of physical memory. The system does no enforcement of this range other than that described in the Validation section.
Pages
Yes, unless dynamic reconfiguration operations that add or delete memory occur. At that point, the value is reset to whatever was provided in the /etc/system file or was calculated from the new physical memory value.
If pageout_reserve is greater than throttlefree / 2, pageout_reserve is set to throttlefree / 2. No message is displayed.
The relationship of cachefree is greater than or equal to lotsfree, which is greater than desfree, which is greater than minfree, which is greater than or equal to throttlefree, should be maintained at all times.
The default value is generally adequate. For systems with relatively static workloads and large amounts of memory, adjust this value downwards. The minimum acceptable value is 64 Kbytes expressed as pages using the page size returned by getpagesize(3C).
Unstable
The Solaris 8 release changes the way file system pages are cached. These changes subsume the priority paging capability.
Remove both cachefree and priority_paging settings in the /etc/system file.
The caching changes remove most of the pressure on the virtual memory system resulting from file system activity. Several statistics exhibit new behavior:
Page reclaims are higher because pages are now explicitly added to the free list after I/O completes.
Free memory is now higher because the free memory count now includes a large component of the file cache.
Scan rates are drastically reduced.
Obsolete
See "cachefree (Solaris 2.6 and Solaris 7 Releases)" for more information.
This variable sets cachefree to 2 times lotsfree.
The Solaris 8 release changes the way file system pages are cached. These changes subsume the priority paging capability.
Remove both cachefree and priority_paging settings in the /etc/system file.
Obsolete
See "priority_paging (Solaris 2.6 and 7 Releases)" for more information.
Defines the number of pages that the system requires be unlocked. If a request to lock pages would force available memory below this value, that request is refused.
Unsigned long
Maximum of the triplet (200, tune_t_minarmem + 100, [10% of memory available at boot time])
Default value to no more than 20% of physical memory. The systems does no enforcement of this range other than that described in the Validation section.
Pages
Yes, unless dynamic reconfiguration operations that add or delete memory occur. At that point, the value is reset to whatever was provided in the /etc/system file or was calculated.
Maximum of the quadruplet (200, tune_t_minarmem + 100, [10% of memory available], and the value from /etc/system). No message is displayed if the value from /etc/system is increased. Done only at boot time.
When memory locking requests or attaching to a shared memory segment with the SHARE_MMU flag fails, yet the amount of memory available seems to be sufficient. Keeping 10% of memory free on a 32-Gbyte system might be excessive.
Excessively large values can cause memory locking requests to fail unnecessarily.
Unstable
The minimum available resident (not swappable) memory to maintain in order to avoid deadlock. Used to reserve a portion of memory for use by the core of the operating system. Pages restricted in this way are not seen when the OS determines the maximum amount of memory available.
Signed integer
25
1 to physical memory
Pages
No
None. Large values result in wasted physical memory.
The default value is generally adequate. Consider increasing it if the system locks up and debugging information indicates the problem was because no memory was available.
Unstable
Maximum number of pages per second that the system looks at when memory pressure is highest.
Signed integer
The lesser of 64 Mbytes and 1/2 of physical memory.
1 to one-half of physical memory
Pages
Yes, unless dynamic reconfiguration operations that add or delete memory occur. At that point, the value is reset to whatever was provided by /etc/system or was calculated from the new physical memory value.
Maximum value is the lesser of 64 Mbytes and 1/2 of physical memory.
When more aggressive scanning of memory is desired during periods of memory shortfall, especially if the system is subject to periods of intense memory demand or when performing heavy file I/O.
Unstable
Minimum number of pages per second that the system looks at when attempting to reclaim memory.
Signed integer
The smaller of 1/20th of physical memory in pages and 100.
1 to fastscan / 2
Pages
Yes, unless dynamic reconfiguration operations that add or delete memory occur. At that point, the value is reset to whatever was provided in the /etc/system file or was calculated from the new physical memory value.
If slowscan is larger than fastscan / 2, slowscan is reset to fastscan / 2. No message is displayed.
When more aggressive scanning of memory is desired during periods of memory shortfall especially if the system is subject to periods of intense memory demand.
Unstable
Minimum percentage of CPU that pageout can consume. This variable is used as the starting point for determining the maximum amount of time that can be consumed by the page scanner.
Signed integer
4
1 to 80
Percentage
Yes
None
Increasing this value on systems with multiple CPUs and lots of memory, which are subject to intense periods of memory demand, enables the pager to spend more time attempting to find memory.
Unstable
The Solaris environment uses a two-handed clock algorithm to look for pages that are candidates for reclaiming when memory is low. The first hand of the clock walks through memory marking pages as unused. The second hand walks through memory some distance after the first hand, checking to see if the page is still marked as unused. If so, the page is subject to reclaim. The distance between the front hand and the back hand is handspreadpages.
Unsigned long
fastscan
1 to maximum number of physical memory pages on the system
Pages
Yes. This parameter requires that the kernel variable reset_hands also be set to a non-zero value. Once the new value of handspreadpages has been recognized, reset_hands is set to zero.
Set to lesser of the amount of physical memory and the handspreadpages value
When you want the amount of time that pages are potentially resident before reclaim is increased. Increasing this value increases the separation between the hands, and therefore, the amount of time before a page can be reclaimed.
Unstable
Part of a system threshold that immediately frees pages after an I/O completes instead of storing the pages for possible reuse. The threshold is lotsfree + pages_before_pager. The NFS environment also uses this threshold to curtail its asynchronous activities as memory pressure mounts.
Signed integer
200
1 to amount of physical memory
Pages
No
None
When the majority of I/O is done for pages that are truly read or written once and never referenced again. Setting this variable to a larger amount of memory keeps adding pages to the free list.
When the system is subject to bursts of severe memory pressure. A larger value here helps to keep a bigger cushion against the pressure.
Unstable
Maximum number of page I/O requests that can be queued by the paging system. This number is divided by 4 to get the actual maximum used by the paging system. It is used to throttle the number of requests as well as to control process swapping.
Signed integer
40
1 to 1024
I/0s
No
None
The maximum number of I/O requests from the pager is limited by the size of a list of request buffers, which is currently sized at 256.
When the system is subject to bursts of severe memory pressure. A larger value here helps to recover faster from the pressure if more than one swap device is configured or the swap device is a striped device.
Unstable