Supported swap space increased.

Matthew Dillon dillon at
Wed Aug 12 15:50:40 PDT 2009

    The swap/paging code is now able to configure up to 1TB x 4 = 4TB of swap,
    up from 8G x 4 = 32G of swap.  I have tested 256G of configured swap on
    a 64-bit kernel.

    However, because the kernel must allocate tracking structures for each
    block of paged-out swap the practical limit is going to be somewhat
    lower.  Approximately 1MB of kernel memory must be wired for every
    1GB of swap which is in-use.  So, for example, supporting 64G of in-use
    swap requires 64M of wired physical memory.  Just having that much
    swap will not eat much memory, its using it that eats memory.

    On i386 about 32M of KVM is reserved by default, giving us a practical
    limit of 32G of swap.

    On 64-bit about 512M of KVM is reserved by default, giving us a
    practical limit of 512G of swap.  Of course, actually using that much
    will wire 512M of system ram so don't get carried away :-)

    The KVM allocation can be changed by setting kern.maxswzone in
    /boot/loader.conf, e.g.


    Note that kernel virtual memory (KVM) is limited on 32 bit kernels
    and you really can't specify a value much larger then 64m.  64-bit
    kernels have a 512G KVM space and do not have that problem, hence
    the higher default reservation.

    There are some intriguing possibilities with the use of SSD-backed
    swap space.  I will be looking into how such a space might be used
    for caching in the cluster work.

					Matthew Dillon 
					<dillon at>

More information about the Kernel mailing list