From owner-freebsd-current@FreeBSD.ORG Thu Oct 4 19:51:11 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8A0E810656C0 for ; Thu, 4 Oct 2012 19:51:11 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-ie0-f182.google.com (mail-ie0-f182.google.com [209.85.223.182]) by mx1.freebsd.org (Postfix) with ESMTP id 5033B8FC1C for ; Thu, 4 Oct 2012 19:51:11 +0000 (UTC) Received: by mail-ie0-f182.google.com with SMTP id k10so2710866iea.13 for ; Thu, 04 Oct 2012 12:51:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=xyuyfPaZhj+a28oCIsvz2GXFPtduZNzx5FCuPpn1vGc=; b=qrHheT6A97sVHaGl/xpPLaeuzel/pXOLsiztAY85lPRig6ZybnNXly1C7vGJR4t3Fx C2ZCjyAjgcpsjgwvNSfzn9FNhwrkto2+1qg+PeAcfM7KGdDeNDRYnQSBNPKAyKB3Jn8d VvqnFm+FZi33JqnZYNIO0G/rMhg5Qvtzn4YoTVHe0FJOzhFZLVa4DWUE3CI4a/cnEXy2 VYPtNPQCYrNeGKME8xAeA9nLE7Yp2U1KyICsKTODMt2/iqzr/3egYseSZKKcEHhwynL+ 17gGIh5wLTswS3g111iah2ixgDo+H7GukP5nR/HAtDHKUSvKl7zRm77r3Q8qTmRIpqs+ iEcw== MIME-Version: 1.0 Received: by 10.50.5.180 with SMTP id t20mr6627354igt.31.1349380269841; Thu, 04 Oct 2012 12:51:09 -0700 (PDT) Received: by 10.64.81.17 with HTTP; Thu, 4 Oct 2012 12:51:09 -0700 (PDT) In-Reply-To: References: Date: Thu, 4 Oct 2012 23:51:09 +0400 Message-ID: From: Sergey Kandaurov To: Darrel Content-Type: text/plain; charset=ISO-8859-1 Cc: current@freebsd.org Subject: Re: memory warnings r240891 | dmesgg X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Oct 2012 19:51:11 -0000 On 4 October 2012 20:18, Darrel 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