From owner-freebsd-fs@FreeBSD.ORG Tue Oct 18 17:46:58 2011 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 176FD106566B; Tue, 18 Oct 2011 17:46:58 +0000 (UTC) (envelope-from olivier@gid0.org) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id AD9858FC14; Tue, 18 Oct 2011 17:46:57 +0000 (UTC) Received: by qadz30 with SMTP id z30so884629qad.13 for ; Tue, 18 Oct 2011 10:46:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.185.19 with SMTP id cm19mr3025416qab.8.1318960016655; Tue, 18 Oct 2011 10:46:56 -0700 (PDT) Received: by 10.224.60.206 with HTTP; Tue, 18 Oct 2011 10:46:56 -0700 (PDT) In-Reply-To: <20111005092603.GA1874@tops> References: <20111002020231.GA70864@icarus.home.lan> <20111005092603.GA1874@tops> Date: Tue, 18 Oct 2011 19:46:56 +0200 Message-ID: From: Olivier Smedts To: Gleb Kurtsou Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: "freebsd-fs@freebsd.org" , Ivan Voras Subject: Re: is TMPFS still highly experimental? X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2011 17:46:58 -0000 2011/10/5 Gleb Kurtsou : > Free RAM is a bit tricky with virtual memory and overcommit support all > over the place. There are at least 3 memory hungry subsystems: buffer > cache, ZFS ARC, tmpfs. > > For the first two there is defined maximum size and they can be shrunk > in low memory situations. Tmpfs grows as much as it can trying to > calculate "free" memory available. Another difference is that tmpfs > can't be shrunk in low memory situation. > > I proposed a patch changing tmpfs memory allocation: > - Define maximum file system size (RAM/2 by default) > - Don't try to check if free memory available, check free swap > =A0instead and allocate more aggressively, i.e. allocate until > =A0swap or file system limit is reached. Patch tested and approved ! I did not test the maximum tmpfs default size because I allocated a max size in my fstab. %cat /etc/fstab none /tmp tmpfs rw,mode=3D1777,size=3D2147483648 0 0 %df -h /tmp Filesystem Size Used Avail Capacity Mounted on tmpfs 2.0G 124k 2G 0% /tmp Mem: 622M Active, 351M Inact, 6491M Wired, 4940K Cache, 2160K Buf, 385M Fre= e Swap: 2048M Total, 36M Used, 2012M Free, 1% Inuse (ZFS is using all my wired memory, the ARC is now full, and I deleted my nearly-never-touched 8G swap in favor of a 2G swap) A little test now : %dd if=3D/dev/zero of=3D/tmp/test bs=3D1M count=3D1500 1500+0 records in 1500+0 records out 1572864000 bytes transferred in 0.763368 secs (2060427243 bytes/sec) %df -h /tmp Filesystem Size Used Avail Capacity Mounted on tmpfs 2.0G 1.5G 542M 74% /tmp % top Mem: 2559M Active, 514M Inact, 4506M Wired, 1656K Cache, 2160K Buf, 274M Fr= ee Swap: 2048M Total, 39M Used, 2009M Free, 1% Inuse So tmpfs made the ZFS ARC cache shrink, without swapping. I did not test filling my active memory to see if the max tmpfs size was shrinking. Cheers ! > > Patch: > http://marc.info/?l=3Dfreebsd-fs&m=3D129747367322954&w=3D2 > https://github.com/glk/freebsd-head/tree/tmpfs > > Thanks, > Gleb. > --=20 Olivier Smedts=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=A0 _ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 ASCII ribbon campaign ( ) e-mail: olivier@gid0.org=A0 =A0 =A0 =A0 - against HTML email & vCards=A0 X www: http://www.gid0.org=A0 =A0 - against proprietary attachments / \ =A0 "Il y a seulement 10 sortes de gens dans le monde : =A0 ceux qui comprennent le binaire, =A0 et ceux qui ne le comprennent pas."