Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Oct 2012 23:51:09 +0400
From:      Sergey Kandaurov <pluknet@gmail.com>
To:        Darrel <levitch@iglou.com>
Cc:        current@freebsd.org
Subject:   Re: memory warnings r240891 | dmesgg
Message-ID:  <CAE-mSOJUYCtzEQZzj2gm=fBUsqA8EsXA99fzp7KQe-=urc0Lbg@mail.gmail.com>
In-Reply-To: <alpine.GSO.2.00.1210041212060.1991@shell1>
References:  <alpine.GSO.2.00.1210041212060.1991@shell1>

next in thread | previous in thread | raw e-mail | index | archive | help
On 4 October 2012 20:18, Darrel <levitch@iglou.com> wrote:
> Hello,
>
> Swap was created twice on this 9.0 release candidate install- once as
> part of zfs and also as encrypted hard drive space.
>
> (30) @ 12:01:50> swapinfo
> Device          1K-blocks     Used    Avail Capacity
> /dev/zvol/bigD/swap   4194304        0  4194304     0%
> /dev/gpt/swap0.eli   3145728        0  3145728     0%
> /dev/gpt/swap1.eli   3145728        0  3145728     0%
> Total            10485760        0 10485760     0%
[...]
> *************************************************************
> FreeBSD 10.0-CURRENT #1 r240891: Tue Sep 25 00:51:03 EDT 2012
>
[...]
> real memory  = 1073741824 (1024 MB)
> avail memory = 937144320 (893 MB
[...]
>
> warning: total configured swap (2621440 pages) exceeds maximum
> recommended amount (1852656 pages).
>
> warning: increase kern.maxswzone or reduce amount of swap.
>
> *************************************************************
>
> Apparently kern.maxswzone is currently equal to 0.  How might I tweak it
> just enough to fix this?

So, reduce amount of swap :)

This is because kernel needs some memory to manage swap too.
Currently for amd64 this roughly reduces to the following rule
(My apologies in advance for the extra simplification):

100MB RAM per 800MB swap space.

So, with your current amount of RAM (893MB) it is recommended to setup
no more than 7144 MB of swap. [1]

[1] Let's look at  vm/swap_pager.c:swapon_check_swzone(npages).
Here npages is the total swap pages you want to setup. The warning will
trigger if (npages > maxpages / 2) becomes true. maxpages is the maximum
pages the system can use for swap management. It is calculated as:
  maxpages = uma_zone_get_max(swap_zone) * SWAP_META_PAGES;
By default SWAP_META_PAGES is 32 on amd64, and swap_zone limit calculates
as available memory pages in system divided by two (assuming that maxswzone
is zero (by default on amd64) and cannot further affect the limit).
So that with X total pages in system, the maximum Y swap pages you are
advised to have is: Y = X * SWAP_META_PAGES / 2 / 2, or X * 8 (on amd64).

-- 
wbr,
pluknet



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAE-mSOJUYCtzEQZzj2gm=fBUsqA8EsXA99fzp7KQe-=urc0Lbg>