Gentoo Archives: gentoo-dev

From: Rich Freeman <rich0@g.o>
To: gentoo-dev@l.g.o
Cc: Nikos Chantziaras <realnc@×××××.de>
Subject: Re: [gentoo-dev] Re: Last rites: www-client/chromium-bin
Date: Sat, 05 Mar 2011 10:29:59
Message-Id: AANLkTimbE-MddHTpQFjUJDGT-xUZ=khV=Omarc18rQ5T@mail.gmail.com
In Reply to: [gentoo-dev] Re: Last rites: www-client/chromium-bin by Nikos Chantziaras
On Sat, Mar 5, 2011 at 5:00 AM, Nikos Chantziaras <realnc@×××××.de> wrote:
> On 03/05/2011 04:41 AM, Rich Freeman wrote: >> I need to >> make sure I have /var/tmp/portage symlinked back to a non-tmpfs >> location whenever I build it or else the system pretty-much dies from >> a lack of RAM. > > Then I'd say you have your tmpfs mount options configured wrongly :-) You > should specify a maximum amount of RAM it should use.  When it fill up, it > then uses swap. >
So, your later redaction aside, I should say that the kernel devs have their swap behavior wrong in any case. Think about it - if you write to a disk-based filesystem every byte that you write ends up on disk, subject to cache (with little discretion - all data needs to be written out within 30 seconds or so). If you have very little RAM free the tmpfs should really be no worse since there too every byte that gets written gets swapped to disk. However, the kernel has complete discretion about when this happens, whether this happens at all, and it gets to write it in a partition optimized for this purpose without regard for long-term preservation/etc. Yet, for whatever reason all this swapping seems slower. The likely reason is that the kernel isn't that good at figuring out what to swap and what not to swap. It might be prioritizing keeping some object files around in RAM on a tmpfs while trying to swap in/out some other process that keeps getting woken up or whatever. Better swap behavior should let the tmpfs perform better than ext4/etc, since it gives the kernel more discretion about what to write out and when.