[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Moving /tmp to tmpfs makes it useless

Carlos Alberto Lopez Perez <clopez@igalia.com> writes:

> On 25/05/12 12:20, Henrique de Moraes Holschuh wrote:
>> On Fri, 25 May 2012, Salvo Tomaselli wrote:
>>>> Because paging out a couple Gigabytes is veeeeeery different from
>>>> writing a couple Gigabytes to disk, of course.
>>> Yes because writing that on disk will only block the thread performing the 
>>> write, not every thread that tries to allocate memory.
>> What IO scheduler are you using?  It must not be CFQ.  CFQ will happly
>> screw it up and stall both readers and writers when the number of dirty
>> pages gets too large (which will happen if you write a gigabyte file to
>> disk).
>> Either that, or you're cheating and your backend devices are simply "fast
>> enough" that it doesn't matter (fast RAID or fast SSD).
>> The real question is: what does it better under CFQ+IO contention?
>> Several threads doing filesystem IO, or the swapper?  Hint: it is not an
>> easy question to answer because it depends on the load, type of load,
>> and backend device.
> I think that any user that has been using Linux for a while knows how
> ugly the things become when the systems starts swapping.
> When the system is swapping, the whole system will become so
> unresponsive while the swapping process is taking place that even your
> mouse pointer will stop moving.
> And this is *very* *very* annoying.
> This is so annoying, that I even had configured my laptop with a very
> low amount of swap, since I rather prefer the oom-killer to kill the
> application that is filling the ram than rather suffer this annoying
> situation.
> So please, don't argue about theoretical things about virtual memory or
> IO schedulers. If you are a desktop Linux user, you should know how ugly
> the things get when the system is swapping.

That is swapping out binaries or their data and needing to wait for it
to be swapped back in. The problem is the waiting for it to be swapped
in there, not that you are swapping.

With large data on tmpfs you will be swapping out lots of data but you
won't block waiting for stuff to be swapped back in in general. Only
something reading back the file will block, not your mouse cursor.

> I don't know the ultimate reason behind this ugly behaviour of Linux
> when the swapping process is happening, but I know this is real and it
> happens because I have experimented this situation myself more than a
> couple of times.

It's a matter of that gets swapped and linux choosing the wrong thing to
swap (far too often). There is some "bug" in linux that when you have
lots and lots of IO at some point the swap heuristics tip over and start
swapping apps and usefull data to create more cache space for
IO. Doesn't matter that you already have 3GB for cache, it still swaps
out your mouse cursor and then things go real bad.


Reply to: