total configured swap exceeds maximum

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

total configured swap exceeds maximum

Wojciech Puchar-8
got this after configuring 160GB in 2 page partitions on 32GB RAM system.


warning: total configured swap (36700158 pages) exceeds maximum
recommended amount (32536376 pages).
warning: increase kern.maxswzone or reduce amount of swap.


what should i set kern.maxswzone to ? it is 0

# sysctl  kern.maxswzone
kern.maxswzone: 0

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: total configured swap exceeds maximum

tech-lists
On Sun, May 19, 2019 at 12:06:38PM +0200, Wojciech Puchar wrote:

>got this after configuring 160GB in 2 page partitions on 32GB RAM system.
>
>
>warning: total configured swap (36700158 pages) exceeds maximum
>recommended amount (32536376 pages).
>warning: increase kern.maxswzone or reduce amount of swap.
>
>
>what should i set kern.maxswzone to ? it is 0
>
># sysctl  kern.maxswzone
>kern.maxswzone: 0
Hi,

Not sure if this answers your question, but my experience of swap was
that it "likes"[1] (4 or 8 or 16GB) * N(umber of swapfiles/partitions)
and N=1 is usual for a system not doing heavy compiling work like poudriere.
It doesn't "like" 32GB or 64GB etc etc

So on one poudriere system there is 32GB ram and 2*16GB swap partitions
and one 16GB swapfile. On another there is 192GB RAM and 3* 16GB swap
partitions. On a regular workstation with 8GB there's just one 8GB
swap partition which is almost never used it seems.

If it's one huge swapfile, it never seems to clear after the build
completes. I have no idea why this might be.

Then there's the thing about dump/panic. IIRC doesn't total swap have to
be at least size_of_ram ?

Like I say, I don't know if the above is "correct" or not. It's just my
experience.

[1] by which I mean "is effective"
[2] swap partition or file is on SSD hardware
--
J.

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: total configured swap exceeds maximum

freebsd-hackers mailing list
In reply to this post by Wojciech Puchar-8
On Sun, 19 May 2019 12:06:38 +0200 (CEST)
Wojciech Puchar wrote:

> got this after configuring 160GB in 2 page partitions on 32GB RAM
> system.
>
>
> warning: total configured swap (36700158 pages) exceeds maximum
> recommended amount (32536376 pages).
> warning: increase kern.maxswzone or reduce amount of swap.
>
>
> 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.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: total configured swap exceeds maximum

Wojciech Puchar-8
>> 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?
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: total configured swap exceeds maximum

Conrad Meyer-2
In reply to this post by tech-lists
Tangent to this thread, but:

On Sun, May 19, 2019 at 5:56 AM tech-lists <[hidden email]> wrote:
> Then there's the thing about dump/panic. IIRC doesn't total swap have to
> be at least size_of_ram ?

It can be smaller if occasional failure is acceptable.  Minidumps are
on by default and only dump active pages.

Additionally, dumpon_flags can set "-Z" for zstd compression in 12.x+.
The numeric speed/compression level is configured with sysctl
kern.kerneldump_gzlevel (perhaps misnamed at this point, but
originally only supported gzip).  In practice, Zstd compression can
often achieve good compression at level 1 or 3, reducing the size of
swap needed to store a complete dump by a factor of maybe 3 without
significant slowdown to the dump process.

Cheers,
Conrad
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: total configured swap exceeds maximum

freebsd-hackers mailing list
In reply to this post by Wojciech Puchar-8


On 2019-May-19, at 08:33, Wojciech Puchar <[hidden email]> 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.

                 Note that swap metadata can be fragmented, which means that
                 the system can run out of space before it reaches the
                 theoretical limit.  Therefore, care should be taken to not
                 configure more swap than approximately half of the
                 theoretical maximum.

                 Running out of space for swap metadata can leave the system
                 in an unrecoverable state.  Therefore, you should only
                 change this parameter if you need to greatly extend the KVM
                 reservation for other resources such as the buffer cache or
                 kern.ipc.nmbclusters.  Modifies kernel option
                 VM_SWZONE_SIZE_MAX.

===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: total configured swap exceeds maximum

freebsd-hackers mailing list
On Sun, 19 May 2019 08:53:15 -0700
Mark Millard wrote:

> On 2019-May-19, at 08:33, Wojciech Puchar <[hidden email]> 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.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: total configured swap exceeds maximum

freebsd-hackers mailing list


On 2019-May-19, at 09:40, RW via freebsd-hackers <freebsd-hackers at freebsd.org> wrote:

> On Sun, 19 May 2019 08:53:15 -0700
> Mark Millard wrote:
>
>> On 2019-May-19, at 08:33, Wojciech Puchar <[hidden email]> 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.

The code that you quoted is old in head/ and stable/12/ and
stable/11/ (but has not been updated in release/12.0.0/ or
in release/11.2.0/ ):


/[base]/head/sys/vm/swap_pager.c

Revision 341375 - (view) (download) (annotate) - [select for diffs]
Modified Sat Dec 1 16:50:12 2018 UTC (5 months, 2 weeks ago) by kib
File length: 75712 byte(s)
Diff to previous 340637
Allow to create swap zone larger than v_page_count / 2.

If user configured the maxswapzone tunable, just take the literal
value for the initial zone sizing attempt.  Before, it was only
possible to reduce the zone by the tunable.

While there, correct the message which was not correct when zone
creation rounded the size up.

Reported by: jmg
Reviewed by: markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential revision:
https://reviews.freebsd.org/D18381



/[base]/stable/12/sys/vm/swap_pager.c

Revision 341716 - (view) (download) (annotate) - [select for diffs]
Modified Sat Dec 8 00:46:05 2018 UTC (5 months, 1 week ago) by kib
File length: 75745 byte(s)
Diff to previous 340333
MFC r341375
:
Allow to create swap zone larger than v_page_count / 2.



/[base]/stable/11/sys/vm/swap_pager.c

Revision 341718 - (view) (download) (annotate) - [select for diffs]
Modified Sat Dec 8 00:48:10 2018 UTC (5 months, 1 week ago) by kib
File length: 73330 byte(s)
Diff to previous 335508
MFC r341375
:
Allow to create swap zone larger than v_page_count / 2.




The new code looks like:

        /*
         * Initialize our zone, taking the user's requested size or
         * estimating the number we need based on the number of pages
         * in the system.
         */
        n = maxswzone != 0 ? maxswzone / sizeof(struct swblk) :
            vm_cnt.v_page_count / 2;


===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"