is TMPFS still highly experimental?
Olivier Smedts
olivier at gid0.org
Tue Oct 18 17:46:58 UTC 2011
2011/10/5 Gleb Kurtsou <gleb.kurtsou at 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
> 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
%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.
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 at 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."
More information about the freebsd-fs
mailing list