memory warnings r240891 | dmesgg
Sergey Kandaurov
pluknet at gmail.com
Thu Oct 4 19:51:11 UTC 2012
On 4 October 2012 20:18, Darrel <levitch at 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
More information about the freebsd-current
mailing list