1. What Do I Do When Physical Memory is Being Reserved Because Swap Reservations Exceed Disk
Based Swap? (Doc ID 1275006.1)
In this Document
Goal
Solution
References
APPLIES TO:
Solaris SPARC Operating System - Version 9 GA and later
OpenSolaris Operating System - Version 2008.05 and later
Solaris x64/x86 Operating System - Version 9 GA and later
Information in this document applies to any platform.
***Checked for relevance on 15-Jan-2015***
GOAL
Check that physical memory is not being reserved to meet a swap reservation which would limit the ability of the
system to use that physical memory for other purposes.
SOLUTION
With virtual memory, user processes no longer directly access memory and all memory accesses reference virtual
memory which is managed by the kernel. This allows the kernel to move the contents of virtual memory into physical
memory so that processes can actually work with their data but the same data can then be moved out of physical
memory to allow other processes to use the same physical memory which effectively allows processes to use more
memory that is physically in the system.
This out of memory storage is called a backing store and for purposes of this document this is swap. Historically, swap
referred to disk based swap and initially there was a requirement that the amount of disk based swap available at
least matched the amount of physical memory as most memory requests reserved an equal amount of swap as
memory.
With the advent of large memory systems, customers no longer wanted to 'waste' large amounts of disk for swap that
would never be used, and as a result the entire swap system was virtualized which removed the need for disk based
swap.This Virtual swap, was based on the amount of disk based swap plus any unused memory. This removed the
need for disk based swap, but can also present issues in some cases.
While a process may request memory, what it actually gets from the kernel is swap. This swap represents the total
amount of 'memory' that the kernel can 'provide' to the process. Note the quotes as to the kernel this is swap and only
a small portion of it may ever actually occupy physical memory at any time, but the process doesn't know this and
can't know this without asking the kernel as this entire process is hidden from the process.
This leads to a two stage process for memory requests and usage, the first is the request which results in a process
being told that it has been given some memory. For this step all that the kernel does is update the process and reserve
the swap by subtracting the swap provided to the process from it's total available swap.
The second stage happens when the process actually tries to use the memory that it has been given. When this
happens the kernel gets notified and verifies that it has promised swap to the process, and assuming that there are no
problems it will proceed to locate some physical memory and update the address mappings so that the process's
attempt to access will succeed.
This two stage process results in swap being used in one of two ways. If the swap actually contains data it is allocated
Document 1275006.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf....
1 of 2 9/23/2015 10:54 AM
2. and has a physical location either in physical memory or in the backing store, if the swap has been promised but not
accessed then it's reserved and doesn't have a location.
While all memory requests go though this two stage process, most processes actually use 'most' of the memory that
they reserve, but few programs use all of the memory that they reserve. This reserved swap, does not contain any
data so has not been referenced but because the kernel has promised this memory to those processes it must ensure
that this virtual swap is not used by anything else.
These two values can be seen from the swap -s command:
$ swap -s
total: XXXXXXXXXk bytes allocated + YYYYYYYYk reserved = ZZZZZZZZZk used, AAAAAAAAAk available
The important value for purposes of this article is the reserved amount which is YYYYYYYYk
If that amount is larger than the total of your disk based swap, then the excess is reserved
by using physical memory which means that memory can never be used for any thing else.
If you use the swap -l command you can determine the size of your disk based swap:
$ swap -l
swapfile dev swaplo blocks free
/dev/zvol/dsk/swappool/swap xx,xx xx SSSSSSSSS ffffffffff
The important value here is the SSSSSSSS or the number of blocks, which from the swap man page:
...
...
blocks The swaplen value for the area in 512-byte blocks.
...
...
This can easily be converted to K which are 1024 by dividing by 2.
If the Amount of Swap Reserved (swap -s) exceeds the size of your disk based swap (swap -l)
then you are reserving physical memory which can not be used for other purposes and you may want to consider
adding additional disk based swap to the system.
REFERENCES
NOTE:1008068.1 - Understanding "no swap space to grow stack" Messages
Didn't find what you are looking for?
Document 1275006.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf....
2 of 2 9/23/2015 10:54 AM