Think of swap space as "current total available virtual memory space
available for program use". It is composed of unreserved RAM (that is,
RAM not currently reserved for usage other than program memory - things
such as file caching, certain ZFS functionality, kernel usage) PLUS
whatever disk space you have allocated for usage as backing store.
Thus, the used + available of 'swap -s' will:
(1) *always* exceed the amount of disk space allocated to swap
(2) *never* be equal to or more than total ram + disk swap
Re-read the section on"Swap Space and Virtual Memory" for particulars on
how Solaris does virtual memory mapping, and the concept of Virtual Swap
Space, which is what 'swap -s' is really reporting on.
The 256MB mentioned in the "How Swap Space is Allocated" section is the
MINIMUM DEFAULT disk swap space. These days, we don't have disk swap
slices that small, so it's safe to ignore.
You can think of the "allocated" swap as virtual addresses that are
mapped to a place on the physical swap device(s) (whether or not they've
actually been written to disk is another question), and the "reserved"
amounts as that which hasn't actually been malloc()'d for use, but the
application has indicated that it might use some additional virtual
address space.
-Erik
On 6/9/2010 8:46 PM, devsk wrote:
Erik,
That doesn't explain anything. More of the same that I found in man
page. What is swap allocated in physical memory? I have hard time
wrapping my arms around that. Is it something like swap cache in
Linux? If its disk-backed, where is the actual location of the backing
store?
And the numbers? 473164k is not same as 256MB as per the table in that
page. If you can explain the individual numbers and how they add up
across 'swap -s', 'swap -l' and 'top -b', that would be great!
-devsk
------------------------------------------------------------------------
*From:* Erik Trimble <erik.trim...@oracle.com>
*Cc:* devsk <funt...@yahoo.com>; zfs-discuss@opensolaris.org
*Sent:* Wed, June 9, 2010 7:41:22 PM
*Subject:* Re: [zfs-discuss] swap - where is it coming from?
On 6/9/2010 7:20 PM, Greg Eanes wrote:
> On Wed, Jun 9, 2010 at 8:17 PM, devsk<funt...@yahoo.com
<mailto:funt...@yahoo.com>> wrote:
>
>> $ swap -s
>> total: 473164k bytes allocated + 388916k reserved = 862080k used,
6062060k available
>>
>> $ swap -l
>> swapfile dev swaplo blocks free
>> /dev/dsk/c6t0d0s1 215,1 8 12594952 12594952
>>
>> Can someone please do the math for me here? I am not able to figure
the total.
>>
>> What is "473164k bytes allocated"? Where is it allocated? In some
hidden zfs swap FS in my root pool?
>> What's the magic behind the number 473164k?
>> What is "388916k reserved"?
>> 862080k+6062060k != 12594952/2 - So, where did the rest of it come
from? I just configured one device in /etc/vfstab.
>> --
>>
>
> man swap
>
> " These numbers include swap space from all configured
> swap areas as listed by the -l option, as well swap
> space in the form of physical memory."
>
This is also a reasonable explanation of what the output of 'swap -s'
actually means.
http://www.softpanorama.org/Solaris/Processes_and_memory/swap_space_management.shtml
Look about half-way down the page, under "Monitoring Swap Resources".
The whole page is worth a read, though.
--
Erik Trimble
Java System Support
Mailstop: usca22-123
Phone: x17195
Santa Clara, CA
--
Erik Trimble
Java System Support
Mailstop: usca22-123
Phone: x17195
Santa Clara, CA
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss