1 |
On Wed, Jul 27, 2011 at 10:40 AM, Neil Bothwick <neil@××××××××××.uk> wrote: |
2 |
> On Wed, 27 Jul 2011 14:41:33 +0100, Peter Humphrey wrote: |
3 |
> |
4 |
>> Doesn't do that here. When tmpfs is full it starts being swapped out to |
5 |
>> the swap partition. Perhaps you didn't have any swap at the time. |
6 |
> |
7 |
> The default size for a tmpfs filesystem is half the physical RAM, unless |
8 |
> you specify more as a mount option, it will never use significant |
9 |
> amounts of swap. |
10 |
> |
11 |
> I wonder how effective tmpfs is for PORTAGE_TMPDIR as the builds that |
12 |
> need a lot of disk space can often require a fair bit of memory too, and |
13 |
> tmpfs is using it all. |
14 |
|
15 |
portage (by default) cleans up after itself after each ebuild, so |
16 |
there's no leakage across ebuilds, but yeah; if you don't have enough |
17 |
RAM for it, stuffing your files and your active processes in the RAM |
18 |
won't work. That's a pretty simple concept. |
19 |
|
20 |
tmpfs for PORTAGE_TMPDIR is great, as long as you have the RAM for it. |
21 |
When I first started using Gentoo, I did. Lately, builds have gotten |
22 |
large enough (especially when I added -ggdb to CFLAGS) that I had to |
23 |
stop using it. |
24 |
|
25 |
However, I can see an argument for tmpfs to still be useful, even if |
26 |
you don't have enough RAM for it, but you do have swap space. If you |
27 |
allow tmpfs to be backed by swap, you can avoid the (unnecessary in |
28 |
this case) bookkeeping done by normal disk filesystems like |
29 |
ext{2|3|4}. So long as your swap partition is as fast as the partition |
30 |
your erstwhile disk filesystem sits on, it'd be a theoretical gain. |
31 |
(Though if you're using a swap *file* as opposed to a swap partition, |
32 |
you'd lose that gain. So YMMV.) |
33 |
|
34 |
With that in mind, I think I'll re-enable tmpfs when I get home, and |
35 |
set it to act as a 16GB filesystem. I only have 6GB of RAM, but tmpfs |
36 |
won't consume more RAM than it has data to fill pages, and the use of |
37 |
swap shouldn't be terrible. |
38 |
|
39 |
My understanding of tmpfs is that it's implemented as a thin layer on |
40 |
top of the file page cache, and that as active processes need more |
41 |
RAM, the file page cache is the first thing to be sacrificed, being |
42 |
flushed to disk. (Presumably, in the case of tmpfs, 'disk' would be |
43 |
'swap') So truly active process memory should have no more trouble |
44 |
remaining in physical RAM than if tmpfs weren't there; if tmpfs |
45 |
weren't there, the data would still sit in the file cache, but would |
46 |
have to pass through a filesystem like ext{2|3|4} (or whatever) on its |
47 |
way to disk. |
48 |
|
49 |
-- |
50 |
:wq |