Max size of one swap slice

Matthew Dillon dillon at
Tue Aug 5 18:29:25 UTC 2008

:> Recently we found that we can only allocate 32GB for one swap slice.
:> Does there is any sysctl oid  or any kernel option to increase it? Why
:> we have this restriction?
:this is a consequence of the data structure used to manage swap space.  See 
:sys/blist.h for details.  It *seems* that you *might* be able to increase the 
:coverage by decreasing BLIST_META_RADIX, but that's from a quick glance and 
:most certainly not a good idea.
:However, the blist is a abstract enough API so that you can likely replace it 
:with something that supports 64bit addresses (and thus 512*2^64 bytes of swap 
:space per device) ... but I don't see why you'd want to do something like 
:this.  Remember that you need memory to manage your swap space as well!
:/"\  Best regards,                      | mlaier at
:\ /  Max Laier                          | ICQ #67774661

    The core structures can handle 2 billion swap pages == 2TB of swap,
    but the blist code hits arithmatic overflows if a single blist has
    more then (0x40000000 / BLIST_META_RADIX) = 1G/16 = 64M swap blocks,
    or 256GB.

    I think the VM/BIO system had additional overflow issues due to
    conversions back and forth between PAGE_SIZE and DEV_BSIZE which
    further restricted the limit to 32GB.  Those restrictions may be gone
    now that FreeBSD is using 64 bit block numbers, so you may be able to
    pop it up to 256GB with virtually no effort (but you need to test it

    With some work on the blist code only (not its structures) the arithmatic
    overflow issues could also be resolved, increasing the swap capability
    to 2TB.

    I do not recommend changing any of the core blist structure, particularly
    not BLIST_META_RADIX.  Just don't try :-).  You do NOT want to bump
    the swap block number fields to 64 bits.

    Also note that significant memory is used to manage that much swap.  It's
    a factor of 1:16384 or so for the blist structures and probably about
    the same amount for the vm_object tracking structures.  32G of swap needs
    around 2-4MB of wired ram.

					Matthew Dillon 
					<dillon at>

More information about the freebsd-stable mailing list