From owner-freebsd-questions@freebsd.org Sun Sep 9 23:57:47 2018 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78B2310A279F for ; Sun, 9 Sep 2018 23:57:47 +0000 (UTC) (envelope-from rwmaillists@googlemail.com) Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F1DEA86744 for ; Sun, 9 Sep 2018 23:57:46 +0000 (UTC) (envelope-from rwmaillists@googlemail.com) Received: by mail-wr1-x42f.google.com with SMTP id k5-v6so19984164wre.10 for ; Sun, 09 Sep 2018 16:57:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9fy00oKHmYOVW+syIvMyzUH9+5swNWfYITmTcsR3ivM=; b=YSih7ajNPeavXBhruhe1UgwaDBFj3aSo/sIkKOAxF4Z7pj/+2XJGLuejhgsCBeYuRo GqW6LE5aKNYpy0wrTJE1hao4RSo8RFwuEKrJ612vdIZml8PK+HJ9mB74CB6qEEsikWFp 702Jfhk+iD0TkR1kOVJO2AYEoESGUAFTzhE3RS+c3ZnBxNRMGGmYmjFIkDHjOEtJy8Zh FaBQBlaEAhJN1mnRlZbA+cpsvTr/C1QomDZ9mCX8b92YClK0cdG/pKfzHvDfd/VLmR6m AGby1K9c1iaRaFaHjbi3KHrBibreLbMNQFE+oJO2lTUogucI4x9CKgSD//KGmFe4efNN zolg== X-Gm-Message-State: APzg51BAdYiFRXL5Rwwqh+cyhd7IjbZuUWnoXLpY6OohwRiD1C2a/0ka FnkU76/MUjaCR41HFGIYcAXqAtH0r/Q= X-Google-Smtp-Source: ANB0VdZcfgVg6/BfiV2AiPB8TE0bFXPg44KH0rv4nHCYkPDR5azpPeeHxqxEirNlmsLUtGD23i1/dA== X-Received: by 2002:adf:dfca:: with SMTP id q10-v6mr12181820wrn.113.1536537465364; Sun, 09 Sep 2018 16:57:45 -0700 (PDT) Received: from gumby.homeunix.com ([90.195.165.238]) by smtp.gmail.com with ESMTPSA id s24-v6sm9860561wmc.7.2018.09.09.16.57.44 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 Sep 2018 16:57:44 -0700 (PDT) Date: Mon, 10 Sep 2018 00:57:43 +0100 From: RW To: freebsd-questions@freebsd.org Subject: Re: swap config Message-ID: <20180910005743.3bf5df59@gumby.homeunix.com> In-Reply-To: References: <10538979.gLySxXtyIk@chameleon.friedrich.org> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; amd64-portbld-freebsd11.1) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Sep 2018 23:57:47 -0000 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 elsewhere.