Gentoo Archives: gentoo-amd64

From: Richard Freeman <rich0@g.o>
To: gentoo-amd64@l.g.o
Subject: Re: [gentoo-amd64] Re: Emerge and Tmpfs
Date: Wed, 08 Jul 2009 18:57:37
Message-Id: 4A54EC02.5080000@gentoo.org
In Reply to: Re: [gentoo-amd64] Re: Emerge and Tmpfs by Peter Humphrey
1 Peter Humphrey wrote:
2 > On Wednesday 08 July 2009 14:51:04 Frank Peters wrote:
3 >> Or is the system designed to extend the tmpfs through swapping?
4 >
5 > Sort of. If the tmpfs becomes full, part of it that isn't needed at the
6 > moment is swapped to disk, exactly as if it had been program space.
7 >
8
9 This is not completely accurate. The size limit you set on the tmpfs is
10 the size of the filesystem. df will show that many bytes free, and if
11 you write one byte more you'll get an error that the filesystem is full.
12
13 Completely independent from this, the kernel will swap memory out to
14 disk when needed. If I have 300GB of RAM, and a 1GB tmpfs, and 5GB of
15 resident programs, most likely nothing will be swapped up until the time
16 the tmpfs is full. At that point the tmpfs will report that it is full,
17 and still nothing will have swapped (most likely - the kernel can still
18 swap stuff out in favor of cache even if the RAM is 99.999% unutilized).
19 If I have 2GB of RAM and 10GB of tmpfs, then the system is guaranteed
20 to swap long before that tmpfs fills up.
21
22 In general, the guideline is to set your tmpfs up to be big enough to
23 handle a large emerge (such as openoffice/firefox) - at least a few GB.
24 Be sure to have enough swap space to handle the size of your full
25 tmpfs + anything you're likely to be running - amount of physical RAM.
26 If you run out of swap before you run out of tmpfs space, then the
27 next write to the tmpfs is going to trigger the OOM killer. I'm not
28 sure how tmpfs is prioritized by the OOM killer, but suffice it to say
29 you're either going to lose tmpfs data or running processes. If you
30 can't make your swap big enough, then you could set a smaller tmpfs and
31 then just unmount it before emerging large programs. Note that more
32 than just portage ends up in /var/tmp - I'm not sure what kde does if
33 its cache disappears mid-session.
34
35 Again, unless you're running in unusual circumstances I don't think you
36 need to worry about the number of tmpfs inodes.