Time to bump default VM_SWZONE_SIZE_MAX?
Colin Percival
cperciva at freebsd.org
Tue Aug 14 08:45:22 UTC 2012
On 08/13/12 14:23, Peter Jeremy wrote:
> 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).
I got that value from a previous mailing list discussion -- I think it was
based on the (incorrect) value of 16 pages per swblock and not exceeding
50% swblock utilization.
> Realistically, I'd say that the default VM_SWZONE_SIZE_MAX can handle about
> 9GB swap (at least, that was my experience).
The 50% utilization rule of thumb would make it 7 GB, but yes, same order
of magnitude.
> 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().
Yes, noted. I'm not actually using lots of swap myself, but I was writing
code for EC2 instances to set up "reasonable" amounts of swap at boot time,
and I don't want to accidentally autoconfigure more swap than FreeBSD can
safely use.
--
Colin Percival
Security Officer Emeritus, FreeBSD | The power to serve
Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid
More information about the freebsd-current
mailing list