Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Jul 2020 07:23:58 -0700
From:      Don Wilde <dwilde1@gmail.com>
To:        Scott Bennett <bennett@sdf.org>, freebsd-stable@freebsd.org
Subject:   Re: swap space issues
Message-ID:  <3afe4d2f-3b1e-a1c5-f947-5f57800317a6@gmail.com>
In-Reply-To: <202007120628.06C6SfNB015907@sdf.org>
References:  <202007120628.06C6SfNB015907@sdf.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On 7/11/20 11:28 PM, Scott Bennett via freebsd-stable wrote:
>       I have read this entire thread to date with growing dismay, and I
> thank Donald Wilde for reporting his ongoing troubles, although they
> spoil my hopes that the kernel's memory management bugs that first became
> apparent in 11.2-RELEASE (and -STABLE around the same time) were not
> propagated into 12.x.  A recent update to stable/12 source tree made it
> finally possible for me to build 12.1-STABLE under 11.4-PRERELEASE, and I
> was just about to install the upgrade when this thread appeared.
Spoiler alert. Since I gave up on Synth, I haven't had a single swap 
issue. It does appear to be one particular port that drove it nuts 
(apparently, one of the 'Google performance' bits, with a 
mismatched-brackets problem). I have rebuilt the machine several times, 
but that's more for my sense of tidiness than anything.

I've got a little Crystal script that walks the installed packages and 
ports and updates them with system() calls.
The machine is very slow, but it's not swapping at all.

It is quite usable now with 12-STABLE.
>
>       On Fri, 26 Jun 2020 03:55:04 -0700 : Donald Wilde <dwilde1@gmail.com>
> wrote:
>
>> On 6/26/20, Peter Jeremy <peter@rulingia.com> wrote:
>>>
[snip]
>>> I strongly suggest you don't have more than one swap device on spinning
>>> rust - the VM system will stripe I/O across the available devices and
>>> that will give particularly poor results when it has to seek between the
>>> partitions.
>       True.  The only reason I can think of to use more than one swapping/
> paging area on the same device for the same OS instance is for emergencies
> or highly unusual, temporary situations in which more space is needed until
> those situations conclude. and even in such situations, if the space can be
> found on another device, it should be placed there.  Interleaving of swap
> space across multiple devices is intended as a performance enhancement
> akin to striping (a.k.a. RAID0), although the virtual memory isn't
> necessarily always actually striped across those devices.  Adding a paging
> area on the same device as an existing one is an abhorrent situation, as
> Peter Jeremy noted, and it should be eliminated via swapoff(8) as soon as
> the extraordinary situation has passed.  N.B. the GENERIC kernel sets a
> limit of four swap devices, although it can be rebuilt with a different
> limit.
That's good data, Scott, thanks! The only reason I got into that 
situation of trying to add another swap device was that it was crashing 
with OO swap messages.
>> My intent is to make this machine function -- getting the bear
>> dancing. How deftly she dances is less important than that she dances
>> at all. My for-real boxen will have real HP and real cores and RAM.
>>
>>> Also, you can't actually use 64GB swap with 4GB RAM.  If you look back
>>> through your boot messages, I expect you'll find messages like:
>>> warning: total configured swap (524288 pages) exceeds maximum recommended
>>> amount (498848 pages).
>>> warning: increase kern.maxswzone or reduce amount of swap.
>       Also true.  Unfortunately, no guidance whatsoever is provided to advise
> system administrators who need more space as to how to increase the relevant
> table sizes and limits.  However, that is a documentation bug, not a code
> bug.
I've got both my kern.max* and CCACHE set up mostly correctly. 
Everything builds and runs well, although I've found that it's helpful 
to only use -j3 while building, not -j4 which would be appropriate for 
my HAMMER i3. I'd much rather have the bear *dancing* than running into 
walls. :D
>> Yes, as I posted, those were part of the failure stream from the synth
>> program. When I had kern.maxswzone increased, it got through boot
>> without complaining.
>>
>>> or maybe:
>>> WARNING: reducing swap size to maximum of xxxxMB per unit
>> The warnings were there, in the as-it-failed complaints.
>>
>>> The absolute limit on swap space is vm.swap_maxpages pages but the
>>> realistic
>>> limit is about half that.  By default the realistic limit is about 4?RAM
>>> (on
>>> 64-bit architectures), but this can be adjusted via kern.maxswzone (which
>>> defines the #bytes of RAM to allocate to swzone structures - the actual
>>> space allocated is vm.swzone).
>>>
>>> As a further piece of arcana, vm.pageout_oom_seq is a count that controls
>>> the number of passes before the pageout daemon gives up and starts killing
>>> processes when it can't free up enough RAM.  "out of swap space" messages
>>> generally mean that this number is too low, rather than there being a
>>> shortage of swap - particularly if your swap device is rather slow.
>>>
>> Thanks, Peter!
>       A second round of thanks to Peter Jeremy for pointing out this sysctl
> variable (vm.pageout_oom_seq), although thus far I have yet to see that it is
> actually effective in working around the memory management bugs.  I have added
> the following lines to /etc/sysctl.conf.
>
> # Because FreeBSD 11.{2,3,4} tie up page frames unnecessarily, set value high
> #vm.pageout_wakeup_thresh=14124 # Default value
> vm.pageout_wakeup_thresh=112640 # 410 MB

[snip]

I do totally agree that these are crucial issues for both operation and 
documentation, although my issues stemmed from bad _userland_ stack 
control.

Those who live on -CURRENT are used to OOPS, but the rest of us get paid 
not to have them.

I am happy with what the Core Team gives us, AND of course we want 
['more','better','faster','STABLE']. :D




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3afe4d2f-3b1e-a1c5-f947-5f57800317a6>