Making Swapoff Faster

As I wrote before, the swapoff Linux system call is slow and inefficient. It’s my job as an OPW intern to speed it up. Now that my mentor has seen my first attempt at a prototype, and he tells me it’s in the ball park, I can say a little about how I will do that.

As you may recall, the present implementation of swapoff looks at all the swapped out memory pages in the swap area that’s going offline, and in the worst case, checks all the page tables in all the running programs to find which programs are using each one. Why check all those page tables repeatedly? It would be much better to just check them once, and as we do, see if each entry in the page table has a corresponding entry in the swap area.

That’s what the new prototype does. It doesn’t even look at the swapped out pages until it finds a page that it can tell is in that swap area. Once I get the bugs out of it, I’ll let you know how well it works.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s