total configured swap exceeds maximum

RW rwmaillists at googlemail.com
Sun May 19 16:40:35 UTC 2019


On Sun, 19 May 2019 08:53:15 -0700
Mark Millard wrote:

> On 2019-May-19, at 08:33, Wojciech Puchar <wojtek at puchar.net> wrote:
> 
> >>> what should i set kern.maxswzone to ? it is 0
> >>> 
> >>> # sysctl  kern.maxswzone
> >>> kern.maxswzone: 0  
> >> 
> >> IIRC for amd64 kern.maxswzone=0 represents the maximum allowed.  
> > so i cannot have more VM than 5*RAM?  
> 
> There is is a kernel memory tradeoff structure to increase in
> kern.maxswzone being larger as I understand. Quoting "man 8 loader"
> (but the "eight times" is system/architecture specific and will
> likely be different):
> 
>    kern.maxswzone
>                  Limits the amount of KVM to be used to hold swap
> metadata, which directly governs the maximum amount of swap the
>                  system can support, at the rate of approximately 200
> MB of swap space per 1 MB of metadata.  This value is specified
>                  in bytes of KVA space.  If no value is provided, the
> system allocates enough memory to handle an amount of swap that
>                  corresponds to eight times the amount of physical
> memory present in the system.

In swap_pager.c

       /*
         * Initialize our zone, guessing on the number we need based
         * on the number of pages in the system.
         */
        n = vm_cnt.v_page_count / 2;
        if (maxswzone && n > maxswzone / sizeof(struct swblk))
                n = maxswzone / sizeof(struct swblk);

In i386  maxswzone defaults to a specific value and it is possible to
increase the size. In amd64  maxswzone defaults to 0 which give the
highest value of n permitted.


More information about the freebsd-hackers mailing list