From owner-freebsd-questions@FreeBSD.ORG Wed Oct 21 01:29:51 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90AA21065694 for ; Wed, 21 Oct 2009 01:29:51 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from poseidon.ceid.upatras.gr (poseidon.ceid.upatras.gr [150.140.141.169]) by mx1.freebsd.org (Postfix) with ESMTP id 3E0578FC36 for ; Wed, 21 Oct 2009 01:29:51 +0000 (UTC) Received: from mail.ceid.upatras.gr (unknown [10.1.0.143]) by poseidon.ceid.upatras.gr (Postfix) with ESMTP id 52CADEB47EB; Wed, 21 Oct 2009 04:29:50 +0300 (EEST) Received: from localhost (europa.ceid.upatras.gr [127.0.0.1]) by mail.ceid.upatras.gr (Postfix) with ESMTP id 425874524A; Wed, 21 Oct 2009 04:29:50 +0300 (EEST) X-Virus-Scanned: amavisd-new at ceid.upatras.gr Received: from mail.ceid.upatras.gr ([127.0.0.1]) by localhost (europa.ceid.upatras.gr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gjectrw6JGRJ; Wed, 21 Oct 2009 04:29:50 +0300 (EEST) Received: from kobe.laptop (adsl93-117.kln.forthnet.gr [77.49.60.117]) by mail.ceid.upatras.gr (Postfix) with ESMTP id EF8B045152; Wed, 21 Oct 2009 04:29:49 +0300 (EEST) Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id n9L1TnXu065550 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 21 Oct 2009 04:29:49 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id n9L1Tmvh065534; Wed, 21 Oct 2009 04:29:48 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: Christopher Hilton References: <9B5D4ADA-E163-4AC5-B293-7C5FA7CE0DA5@vindaloo.com> Date: Wed, 21 Oct 2009 04:29:48 +0300 In-Reply-To: <9B5D4ADA-E163-4AC5-B293-7C5FA7CE0DA5@vindaloo.com> (Christopher Hilton's message of "Tue, 20 Oct 2009 11:20:38 -0400") Message-ID: <87d44h4jqr.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: freebsd-questions@freebsd.org Subject: Re: /tmp on mfs X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Oct 2009 01:29:51 -0000 On Tue, 20 Oct 2009 11:20:38 -0400, Christopher Hilton wrote: > Reading the list yesterday I came across a little controversy about swap > backed /tmp filesystems. I've been using this in my /etc/rc.conf > > tmpmfs="YES" # Set to YES to always create an mfs /tmp, NO to never > tmpsize="1g" # Size of mfs /tmp if created > tmpmfs_flags="-S -o async,noexec" # Extra mdmfs options for the mfs /tmp > > To mount /tmp on a swap backed filesystem. I've been assuming that > data stored in the /tmp directory was held in RAM and then written to > the swap space only when the system had a more pressing need for the > RAM. I typically configure my systems with swap == 2 * RAM or more. > And on the systems in question I have at least 1Gb of RAM. I was > hoping to use this trick to enhance the performance of the postgresql > database (temp_tablespace=/tmp/pgsql/....) Is my assumption about > where the data in a temporary file is stored incorrect? Hi Christopher, The rc.conf(5) options for `tmpmfs' and `varmfs' use the mdmfs(8) to create the respective filesystems. The default behavior of mdmfs(8) is to create a swap-backed filesystem. Swap-backed filesystems, as the manpage of mdconfig(8) described them, work exactly as you wrote: swap Storage for this type of memory disk is allocated from buffer memory. Pages get pushed out to the swap when the system is under memory pressure, otherwise they stay in the operating memory. Using swap backing is generally preferable over malloc backing. So your understanding of the way tmpmfs behaves is fine.