# # swap prefetching argument still continues
APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Swap Prefetch Arguments

I've removed advertising from most of this site and will eventually clean up the few pages where it remains.

While not terribly expensive to maintain, this does cost me something. If I don't get enough donations to cover that expense, I will be shutting the site down in early 2020.

If you found something useful today, please consider a small donation.



Some material is very old and may be incorrect today

© February 2008 Anthony Lawrence

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:


There is a reason for this. Device drivers either work or they do not, but the virtual memory subsystem behaves a little differently for every workload which is put to it. Tweaking the heuristics which drive memory management is a difficult process; a change which makes one workload run better can, unpredictably, destroy performance somewhere else. And that "somewhere else" might not surface until some large financial institution somewhere tries to deploy a new kernel release. The core kernel maintainers have seen this sort of thing happen often enough to become quite conservative with memory management changes. Without convincing evidence that the change makes things better (or at least does no harm) in all situations, it will be hard to get a significant change merged.

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..


If you found something useful today, please consider a small donation.



Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

->
-> swap prefetching argument still continues


Inexpensive and informative Apple related e-books:

iOS 8: A Take Control Crash Course

Photos for Mac: A Take Control Crash Course

Take Control of Apple Mail, Third Edition

Take Control of Numbers

Take Control of High Sierra





More Articles by © Anthony Lawrence





Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us


Printer Friendly Version





The activity of "debugging", or removing bugs from a program, ends when people get tired of doing it, not when the bugs are removed. (Datamation)




Linux posts

Troubleshooting posts


This post tagged:

Kernel

Linux

Unix



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode