1 |
On Sat, Mar 5, 2011 at 5:00 AM, Nikos Chantziaras <realnc@×××××.de> wrote: |
2 |
> On 03/05/2011 04:41 AM, Rich Freeman wrote: |
3 |
>> I need to |
4 |
>> make sure I have /var/tmp/portage symlinked back to a non-tmpfs |
5 |
>> location whenever I build it or else the system pretty-much dies from |
6 |
>> a lack of RAM. |
7 |
> |
8 |
> Then I'd say you have your tmpfs mount options configured wrongly :-) You |
9 |
> should specify a maximum amount of RAM it should use. When it fill up, it |
10 |
> then uses swap. |
11 |
> |
12 |
|
13 |
So, your later redaction aside, I should say that the kernel devs have |
14 |
their swap behavior wrong in any case. |
15 |
|
16 |
Think about it - if you write to a disk-based filesystem every byte |
17 |
that you write ends up on disk, subject to cache (with little |
18 |
discretion - all data needs to be written out within 30 seconds or |
19 |
so). |
20 |
|
21 |
If you have very little RAM free the tmpfs should really be no worse |
22 |
since there too every byte that gets written gets swapped to disk. |
23 |
However, the kernel has complete discretion about when this happens, |
24 |
whether this happens at all, and it gets to write it in a partition |
25 |
optimized for this purpose without regard for long-term |
26 |
preservation/etc. Yet, for whatever reason all this swapping seems |
27 |
slower. |
28 |
|
29 |
The likely reason is that the kernel isn't that good at figuring out |
30 |
what to swap and what not to swap. It might be prioritizing keeping |
31 |
some object files around in RAM on a tmpfs while trying to swap in/out |
32 |
some other process that keeps getting woken up or whatever. |
33 |
|
34 |
Better swap behavior should let the tmpfs perform better than |
35 |
ext4/etc, since it gives the kernel more discretion about what to |
36 |
write out and when. |