From owner-freebsd-fs@FreeBSD.ORG Tue Oct 18 21:49:10 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 8BFEC106564A; Tue, 18 Oct 2011 21:49:10 +0000 (UTC) (envelope-from gleb.kurtsou@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id DDE608FC15; Tue, 18 Oct 2011 21:49:09 +0000 (UTC) Received: by bkbzu17 with SMTP id zu17so1701178bkb.13 for ; Tue, 18 Oct 2011 14:49:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=3RSAw/uH7jgEnEyW5qUid/L+zTWTbwHYuROS800fAAs=; b=KNpkrgga9aIq1jY6K20WTc8W48dgukZ6qRY5M+yjGBEbL7jFyg3jXmRFGOk5s+IYCK rvLBoQNQL5jGCTfHQXOhKHJbPIFsnYnBF/V9rXnqn+rXOAD1sIazk/dnGXURHI11R9vU 7Wo9MkefqOSxXFVdrNbWeHjhZJv9x5YOqoj38= Received: by 10.204.157.142 with SMTP id b14mr3103164bkx.44.1318974547777; Tue, 18 Oct 2011 14:49:07 -0700 (PDT) Received: from localhost ([78.157.92.5]) by mx.google.com with ESMTPS id z9sm3661323bkn.7.2011.10.18.14.49.05 (version=SSLv3 cipher=OTHER); Tue, 18 Oct 2011 14:49:06 -0700 (PDT) Date: Wed, 19 Oct 2011 00:46:34 +0300 From: Gleb Kurtsou To: Olivier Smedts Message-ID: <20111018214634.GA55276@tops> References: <20111002020231.GA70864@icarus.home.lan> <20111005092603.GA1874@tops> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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 21:49:10 -0000 On (18/10/2011 19:46), Olivier Smedts wrote: > 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 > >  instead and allocate more aggressively, i.e. allocate until > >  swap 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=1777,size=2147483648 0 0 You may specify human friendly size, e.g. size=2G. I'll add live tmpfs resize once decision is made that patch can be committed. > > %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 Free > 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=/dev/zero of=/tmp/test bs=1M count=1500 > 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 Free > 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. tmpfs size won't change. You'll be able to write to tmpfs until either filesystem size or swap limit reached. It's for administrator to decide how large tmpfs can grow. Simply put, there is no way to compete with ZFS and buffer cache in trying to use all "free" memory, unlike those tmpfs data can't be freed when needed. > > Cheers ! > > > > > Patch: > > http://marc.info/?l=freebsd-fs&m=129747367322954&w=2 > > https://github.com/glk/freebsd-head/tree/tmpfs > > > > Thanks, > > Gleb. > > > > > -- > Olivier Smedts                                                 _ >                                         ASCII ribbon campaign ( ) > e-mail: olivier@gid0.org        - against HTML email & vCards  X > www: http://www.gid0.org    - against proprietary attachments / \ > >   "Il y a seulement 10 sortes de gens dans le monde : >   ceux qui comprennent le binaire, >   et ceux qui ne le comprennent pas."