There's an article about Linux swapping and a proposed kernel patch over at Still waiting for swap prefetch that attracted a fair pile of comments at the time it was written. I don't know what caused me to trip over it today, but it did make me think about a few things.
First, the concept is simple enough: if stuff has been swapped because there wasn't room in RAM, but now there is because some program just exited, maybe the stuff that was swapped should be brought back now instead of waiting until it is actually needed.
Before you get too hot and heavy over this, you should know that you'll find bright people on both sides of the issue but at the end of the day this proposed change is still not in the Linux kernel. The LWN article suggests that this is due to well warranted conservatism:
That makes perfect sense to me. Ideally, there'd never be any need for this anyway: you'd always have enough RAM to run everything you need. In practice, well, we always try to push a little harder. There's some merit to the argument that says "if you have spare memory, the machine is under utilized" - though of course that's more true in a business setting than on our personal desktops.
Actually, for personal desktops, anticipating swap needs could be done by following our mouse cursor - if I move out of one window and stop moving over another, that's a pretty good indication I'm going to click there, right? So if that program's data is currently in swap, hey, start bringing it back..
You could carry it farther by tracking my eye focus.. I'll surely move my glance toward the application I want even before I start moving the mouse - our anticipatory swap fetcher could bring in a few bytes just based on that.. and if the operating system were really smart, it would have an extensive database of my behavioral habits anyway. A smart OS would know that I'll be spending so much time in a command line window, so much time in a browser, but now and then I'll be switching over to email.. and that smart OS would swap those things only as a last resort. The Windows XP that I run under virtualization can probably be swapped out the minute I move my mouse off it - the OS would know that I'm unlikely to come back again for a while at least.
Well, none of that exists now, but it certainly could..
Got something to add? Send me email.
(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version
Increase ad revenue 50-250% with Ezoic