Memory swap when there's apparently plenty of free RAM

Memory swap when there's apparently plenty of free RAM

Nadav Har'El nyh at math.technion.ac.il
Mon Jun 18 17:21:23 IDT 2012


On Mon, Jun 18, 2012, Eli Billauer wrote about "Memory swap when there's apparently plenty of free RAM":
> When I opened Google Chrome last (I don't use it a lot), the
> computer froze completely for a minute, no mouse movement, no
> response to CTRL-Alt-F2, and the clock didn't change. The hard disk
> was highly active. After that minute, all resumed to normal, and the
> Chrome browser started as if nothing had just happened.
> 
> It then turned out that 2 GB of RAM had been swapped to disk.

I'm not sure I understood - when you say "opened Google Chrome", was
Chrome already running for a long time at that point (sitting somewhere
in the background), or did you run it anew?

Also, when you say "it turned out that 2 GB of RAM had been swapped to
disk", I assume you really know that before using chrome it was 0
swapped out, and when you used chrome it jumped to 2 GB - rather what
you know is only that it was 2GB after?

I the answers are that 1. Google Chrome was already running for a long time
(it wasn't a new run), and 2. You don't know what was the swap situation
a moment before using Chrome, then I may have an explanation.
(see http://lwn.net/Articles/83588/ for more info, and it also explains
the "swappiness" parameter that Muli pointed to).

It is possible that some time earlier, some process accessed many
gigabytes of files. Perhaps you had some backup process running during
the previous night. Or perhaps you did a large "yum update" earlier
(though Fedora 12 doesn't get updates any more ;-)). Or perhaps you
have a file server on your machine, or you watched a large movie.
I don't know. The point is that Chrome has been idle for many hours, not
touching any of its memory, and at some point Linux may have decided
that instead of keeping it in memory, it's better to swap it out and
use the extra memory for caching more files which were accessed by your
backup/server/movie-watching or whatever.

Then, when you came back and touched Chrome, not only did it need to
swap in many of Chrome pages, it also had to read from disk many clean
pages - parts of the chrome executable (it's a 70 MB wopper of an
executable) and parts of the 71 (!!!) shared libraries that Chrome
depends on, and so on. Since all of this isn't likely to be contiguous
on disk, it can cause a huge number of seeks, and be very slow.

Just a guess....


-- 
Nadav Har'El                        |                    Monday, Jun 18 2012, 
nyh at math.technion.ac.il             |-----------------------------------------
Phone +972-523-790466, ICQ 13349191 |To decide or not to decide, that is the
http://nadav.harel.org.il           |question. Or is it?



More information about the Linux-il mailing list