Re: Why does the disk still thrash when I have no swap?

From: Ben Nizette
Date: Sun Nov 29 2009 - 01:06:30 EST


On Sun, 2009-11-29 at 14:59 +1000, Adam Nielsen wrote:
> Could it be that the disk cache was
> forced to shrink and suddenly all accesses to the filesystem became unbuffered
> and incredibly slow? Why would this stop the X11 mouse cursor from moving?

Pretty much, yeah. Well, not so much that the filesystem became
unbuffered, the new files you're accessing would have still been pulled
in to RAM, but rather all the old files you were no longer accessing but
were still in memory had to hit the disk before new allocations could
succeed.

Given the modern programmer's love of OOP, pretty much every action you
can think of causes a massive number of (generally small) allocations
and even though each one would likely free shortly after, could still
potentially trigger a dirty page writeback before the allocation would
succeed.

This is one of my pet annoyances - most OOP programmers forget that
object creation is potentially IO-bound in low memory situations (either
by swap or by pagecache writeback) and wonder why seemingly innocuous
things like "new Integer()" can take many seconds to complete!

--Ben.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/