Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Oct 2011 19:46:56 +0200
From:      Olivier Smedts <olivier@gid0.org>
To:        Gleb Kurtsou <gleb.kurtsou@gmail.com>
Cc:        "freebsd-fs@freebsd.org" <freebsd-fs@freebsd.org>, Ivan Voras <ivoras@freebsd.org>
Subject:   Re: is TMPFS still highly experimental?
Message-ID:  <CABzXLYNU%2B397-scL5vGAq1rC%2BDx76ceMMNt9HUag%2Ba7iP8eL_w@mail.gmail.com>
In-Reply-To: <20111005092603.GA1874@tops>
References:  <alpine.GSO.1.10.1110011122030.882@multics.mit.edu> <CADLo83-s_3H8PbbxOPPxbe0m10U0U5JW-feB294dFs%2BQ3iTWvg@mail.gmail.com> <CAGMYy3ssi%2BkAuufDTHA1z6u7jRrZwRRkCCkcO94GHNGF9Rku_w@mail.gmail.com> <20111002020231.GA70864@icarus.home.lan> <CAGMYy3sCCxOiVqeP4PVbvxnpcyoyQZoL%2Bw3nY8STYnpUNfj6JQ@mail.gmail.com> <j6aorc$hf0$1@dough.gmane.org> <CAGMYy3tbMWU6JU1%2B%2B5XmzjZTrV1=oAgRaaDE3-=MMT73F_ojQQ@mail.gmail.com> <CABzXLYNLhP%2BYFvT5Sw=hKVF6d_Yvmt%2Be_QjH7ghX-2MyzS0wWA@mail.gmail.com> <CAGMYy3s7RrP8oWC%2BJYgSG3hU1EXgKmnf%2BWQRiE2CDu4bHuz3UA@mail.gmail.com> <CABzXLYO-gRt6o6wrevEFwwtTneYiShYD9UbK=j0UUUBzVob5jA@mail.gmail.com> <20111005092603.GA1874@tops>

next in thread | previous in thread | raw e-mail | index | archive | help
2011/10/5 Gleb Kurtsou <gleb.kurtsou@gmail.com>:
> 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."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CABzXLYNU%2B397-scL5vGAq1rC%2BDx76ceMMNt9HUag%2Ba7iP8eL_w>