Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Sep 2018 00:57:43 +0100
From:      RW <>
Subject:   Re: swap config
Message-ID:  <>
In-Reply-To: <>
References:  <> <> <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Sun, 09 Sep 2018 12:40:03 +0000
Lorenzo Salvadore via freebsd-questions wrote:

> > My system has 16GB of memory, so I multiplied that by 4 to get 64GB.
> > I created a swap partition of 64GB.
> > When I boot, I get:
> > warning: total configured swap (16777216 pages) exceeds maximum
> > recommended amount (986928 pages).
> > warning: increase kern.maxswzone or reduce amount of swap.
> > I tried adding kern.maxswzone to /boot/loader.conf but it complains
> > no matter what value I set.
> > What should I do? I'm not actually swapping, since I have so much
> > memory, so I could turn swap off and re-create the swap partition.
> > Correct?  

IIRC there is a hard limit of 4XRAM, and there is an area of the
partition reserved for metadata. I don't recall how the arithmetic is
done, but it may be necessary to make kern.maxswzone a bit smaller than
the number of 4kB pages in 64GB , and/or make the actual partition a bit
smaller than the size implied by kern.maxswzone.

> The swap space you reserve depends of course on what you do with your
> computer, however 64GB, whatever your use is and whatever the formula
> you used to determine this is, seems huge to me. Keep in mind that
> 1.  as you say, you already have 16GB of RAM and you are not
> swapping, hence you are waisting 64GB of HD;

Still a modest amount.
> 2.  swap is slow: if you ever happen to need that much swap space,
> then you would better have a very fast computer to still use it! I.e.
> a very fast disk access (cpu speed is secondary), and I doubt normal
> computers are able to reach such high speeds.

I have 16GB or ram and 24GB of swap.  I used swap for two reason. The
first is to mitigate any slow memory leaks, the second is to back tmpfs.
Neither of these rely on anything being particularly fast. 

Whilst the point of tmpfs is to keep short-lived files in ram, I
wouldn't want something to fail because I'd limited storage to less
than ram size. I also wouldn't want to deny the kernel the option of
pushing long-lived files out to swap if the memory is needed

Want to link to this message? Use this URL: <>