On Wed, Mar 28, 2001 at 12:14:33PM -0500, Noah L. Meyerhans wrote: > I guess that kind of makes sense. If the kernel ever needs to access > the swapped pages, it's got them cached so it can do it quickly. > But if it ever needs a whole lot of RAM for something else¸ it can merely > re-allocate that cache. That way the swapped data will still be > swapped. > > Of course, as to the question about *why* all those pages got swapped > out to begin with is one that I can't answer.
But you already answered the question... If a page looks unlikely to be used in the near future and there's spare CPU and I/O bandwidth available, there's no reason not to swap it to cache. If it's needed, the cost of restoring it from cached swap is approximately 0 (potentially on the order of only a few CPU cycles, depending on how this is organized) and if there's something better to do with the memory, the cache can be flushed similarly quickly. -- Linux will do for applications what the Internet did for networks. - IBM, "Peace, Love, and Linux" Geek Code 3.1: GCS d? s+: a- C++ UL++$ P++>+++ L+++>++++ E- W--(++) N+ o+ !K w---$ O M- V? PS+ PE Y+ PGP t 5++ X+ R++ tv b+ DI++++ D G e* h+ r y+