Bug 227436 - increasing kern.maxswzone does nothing
Summary: increasing kern.maxswzone does nothing
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 11.1-STABLE
Hardware: Any Any
: --- Affects Many People
Assignee: Mark Johnston
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2018-04-11 01:43 UTC by Curtis Villamizar
Modified: 2019-05-21 20:56 UTC (History)
6 users (show)

See Also:


Attachments
patch to sys/vm/swap_pager.c (see comments for description) (2.65 KB, patch)
2018-04-11 01:43 UTC, Curtis Villamizar
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Curtis Villamizar 2018-04-11 01:43:39 UTC
Created attachment 192425 [details]
patch to sys/vm/swap_pager.c (see comments for description)

On current and on 11.1 when using a large amount of swap, increasing kern.maxswzone does not allow more swap to be used as it used to in 11.0.

A patch is attached which has been tested on AMD64 and ARM64 kernels using 11.1 stable and current.  It does the following:

1.  If maxswzone is set to less than the system guess (based on RAM), then reduce maxswzone as specified (current behaviour).

2.  There is a conditional that could be removed that caps the increase in maxswzone to 8 times the guess based on RAM (lots of swap, but lots is needed for small ARM stuff that has 512MB or 1GB RAM.  Also had to increase kern.maxswzone on some of my AMD64 servers with 8GB RAM).

3.  An increase is made to the effective maxswzone value used (n in the code) subject to the above conditional (which could be removed).

4.  Change a printf statement to give swap sizes in pages and MB when kern.maxswzone is too small for the amount of swap.

5.  Add printf indicating the minimum value of kern.maxswzone that will quiet the warning (and presumably allow that amount of swap to be used).

6.  Add a conditional that catches the case where the guess at the size of struct swblk in sys/i386/include/param.h is wrong.  This code was removed in other architectures so affects i386 only.  I added this code temporarily to amd64 to test.

I've been using this patch with no adverse affect on multiple production servers and vm for a few weeks.  Given that all it does is allow increase in kern.maxswzone to take effect, it should be safe and should go into 11.2, but at least go into 12.
Comment 1 John Baldwin freebsd_committer freebsd_triage 2018-04-16 18:14:03 UTC
Adding kib@ to cc as this seems to be related to r323537.
Comment 2 Ed Maste freebsd_committer 2019-05-21 19:24:09 UTC
See r341375, https://reviews.freebsd.org/rS341375
markj@ will check if there's something more to do here
Comment 3 Mark Johnston freebsd_committer 2019-05-21 20:56:29 UTC
I believe most of the original patch is subsumed by r341375.  The i386 bit is interesting; the limit we have in i386/include/param.h is bogus and probably makes less sense since the 4/4 split.