LWN.net Logo

Still waiting for swap prefetch

Still waiting for swap prefetch

Posted Jul 25, 2007 23:20 UTC (Wed) by xorbe (subscriber, #3165)
In reply to: Still waiting for swap prefetch by elanthis
Parent article: Still waiting for swap prefetch

When I have 2GB of ram in my home desktop system, I never ever want to see Linux drop binaries from ram, and swap them back in from the binary text file. Or see it drop data pages to increase hdd cache in memory.


(Log in to post comments)

Still waiting for swap prefetch

Posted Jul 25, 2007 23:40 UTC (Wed) by johnkarp (guest, #39285) [Link]

Even when the disk-cache-pages are more frequently used than the
program-text-pages? If I understand things correctly, a program has to
wait ~9ms when the data it needs is on the disk, whether its program text
or data. Also, programs often have pages that are *never* used after
startup; the sooner those pages are evicted in favor of useful things the
better.

Still waiting for swap prefetch

Posted Jul 25, 2007 23:47 UTC (Wed) by sjlyall (subscriber, #4151) [Link]

When I have 2GB of ram in my home desktop system, I never ever want to see Linux drop binaries from ram, and swap them back in from the binary text file. Or see it drop data pages to increase hdd cache in memory.

Turn off swap then if you feel that way. I've got no problem with my system swapping out the getty copies which will never be used and instead using the RAM to cache my mail files.

I have a bunch of stuff that includes running programs, program data and files that the CPU has to deal with. I want everything to go as fast a possible so whenever possible if the CPU wants some of that data it should be able to get it as quickly as possible which means it should be in RAM if at all possible. The better the kernel does this, the faster everything will run.

Still waiting for swap prefetch

Posted Aug 7, 2007 2:33 UTC (Tue) by xorbe (subscriber, #3165) [Link]

Even with swap off, kernel can drop the program text, and swap it in from the backing binary on disk -- all without a swap file.

OpenOffice comes with a "pagein" utility.

Posted Jul 26, 2007 0:14 UTC (Thu) by dmarti (subscriber, #11625) [Link]

Why should the kernel have to guess what to page back in when you could use the "pagein" from OpenOffice, or something like it? Here's a simple example.

OpenOffice comes with a "pagein" utility.

Posted Jul 26, 2007 0:39 UTC (Thu) by corbet (editor, #1) [Link]

Interesting. It's doing something different, though: it's indiscriminately bringing in pages from the program's text area. I can't see how it could do anything about process anonymous pages which have been shoved into swap. Somebody who really wanted to enjoy their coffee hot would want to use both pagein (for text) and prefetch (for data) - and find some, currently unknown way to balance the two.

IWFM

Posted Jul 26, 2007 16:13 UTC (Thu) by dmarti (subscriber, #11625) [Link]

Subjectively, for me, running that shell function seems to get rid of the lag on alt-tab to Firefox, Gimp, or OpenOffice first thing in the morning.

What would be better, for a desktop system, would be a "goodnight" script that would run housekeeping tasks such as updatedb and logrotate, then page back in whatever the user had been working on, then suspend.

explicit pagein

Posted Jul 27, 2007 22:12 UTC (Fri) by giraffedata (subscriber, #1954) [Link]

To avoid the manual step (either good morning or good night), I run this in a cron job every hour all day. It doesn't matter that the interactive programs get paged in uselessly several times during the night; even if done right in the middle of updatedb, they just get paged right out again and the cost is insignificant.

I also send messages through some response-time-critical daemons regularly, to "loosen them up." I.e. page in executables, anonymous pages, etc.

Still waiting for swap prefetch

Posted Jul 27, 2007 0:05 UTC (Fri) by jschrod (subscriber, #1646) [Link]

Then you will be surprised.

When you get 2GB (I have them), just start Eclipse on a larger project, while Firefox and Thunderbird are running; and watch your memory getting used. And you didn't even start any VM (Xen or VMware)...

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds