Re: Time to bump default VM_SWZONE_SIZE_MAX?

From: Peter Jeremy <peter_at_rulingia.com>
Date: Tue, 14 Aug 2012 07:23:09 +1000
On 2012-Aug-12 15:44:07 -0700, Colin Percival <cperciva_at_freebsd.org> wrote:
>If I'm understanding things correctly, the "maxswzone" value -- set by the
>kern.maxswzone loader tunable or to VM_SWZONE_SIZE_MAX by default -- should
>be approximately 9 MiB per GiB of swap space.

I'm not sure how you got that value.  By default, struct swblock is
288 bytes (280 bytes on 32-bit archs) and can store up to 32 pages of
swap (the comment in vm/swap_pager.c:swap_pager_swap_init() is wrong).
For x86, this is 2.25 MiB per GiB (best case).

>The current default for VM_SWZONE_SIZE_MAX was set in August 2002 to 32 MiB;
>meaning that anyone who wants to use more than ~ 3.5 GB of swap space ought
>to set kern.maxswzone in /boot/loader.conf.

In practice, you can't fully populate each swblock.  I did a test on
my amd64 box by running multiple copies of a program that allocates
and dirties a big chunk of RAM and then pause()s.  That gave me a 90%
swblock utilisation - which I suspect is higher than a typical
scenario where memory pressure pushes more randomly unused pages out.

Realistically, I'd say that the default VM_SWZONE_SIZE_MAX can handle
about 9GB swap (at least, that was my experience).

BTW, if you plan on allocating lots of swap, be aware that each swap
device is limited to 32GiB - see vm/swap_pager.c:swaponsomething().

-- 
Peter Jeremy

Received on Mon Aug 13 2012 - 19:23:23 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:29 UTC