I got passed a call today where the customer was concerned that they were using 65% of their available swap. Given that the machine had 128gb of memory and about 16gb free they were concerned at what may be using swap.
The output that lead to the concern was:
$ swap -s
total: 6515808k bytes allocated + 3248840k reserved = 9764648k used, 102445552k available
From this output it would be easy to assume that we are using 6.2 gb of swap and the customer knew that they only had an 8gb swap volume.
The part that is often overlooked is the available amount. If we add available and used we end up with 107gb. That's substantially larger than the swap volume size.
What is going on here?
First some definitions from "Solaris Internals"
and a few from swap(1M)
Solaris uses all available pageable memory as virtual swap space in
addition to the disk-based swap space.
The amount of virtual swap space available is the amount of available
pageable physical memory plus the amount of disk-based swap space
Solaris reserves the virtual swap space from the disk- based swap
first. Only if disk-based swap is exhausted or unconfigured, the
reservation is done from physical memory.
swap -s" reports on "virtual swap". To look at the actual amount of disk
based swap in use we need to look at "
In this case we see
$ swap -l
swapfile dev swaplo blocks free
/dev/zvol/dsk/rpool/swap 256,1 16 16777200 16777200
The crucial take away in this output is that
blocks == free. This means that we are not using any disk based swap.