Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Aug 2012 07:23:09 +1000
From:      Peter Jeremy <peter@rulingia.com>
To:        Colin Percival <cperciva@freebsd.org>
Cc:        FreeBSD current <freebsd-current@freebsd.org>
Subject:   Re: Time to bump default VM_SWZONE_SIZE_MAX?
Message-ID:  <20120813212309.GA74129@server.rulingia.com>
In-Reply-To: <502831B7.1080309@freebsd.org>
References:  <502831B7.1080309@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--PEIAKu/WMn1b1Hv9
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2012-Aug-12 15:44:07 -0700, Colin Percival <cperciva@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 Mi=
B;
>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().

--=20
Peter Jeremy

--PEIAKu/WMn1b1Hv9
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (FreeBSD)

iEYEARECAAYFAlApcD0ACgkQ/opHv/APuIeGzgCgnHz+eaHudb1YePddap28MTaH
S7wAmgKY5TPkNaslUTrh3/3WI03rmkdN
=hkWg
-----END PGP SIGNATURE-----

--PEIAKu/WMn1b1Hv9--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120813212309.GA74129>