Friday, January 21, 2011

let's add swap!

Android, at least on my Droid X, doesn't use swap.  And I'm sure there's a good reason for that - one of them being that it doesn't need one.  As long as it has plenty of memory and killer memory management why bother?

Still, I thought it would be fun to add since Android runs a linux kernel and linux likes swap.

I think you can do some interesting things. If you have swap, you can perhaps encourage the kernel to swap out some rarely used processes like Xfinity, etc. (or at least some portions of it. Isn't it annoying how Xfinity always sticks around). Then you can tell the kernel to use more of the RAM for cache, thus making the phone faster. I know android already does a good job in managing memory and killing off less used processes but I think with swap we'd have a lot more flexibility.

Well, let's give it a shot, shall we?
# dd if=/dev/zero of=/mnt/sdcard/swap bs=1k count=100000
100000+0 records in
100000+0 records out
100000 bytes transferred in 0.713 secs (140252 bytes/sec)
# mkswap /mnt/sdcard/swap
Setting up swapspace version 1, size = 95904 bytes
Whoa! Looking good...
# swapon /mnt/sdcard/swap
swapon: /mnt/sdcard/swap: Function not implemented


  1. Ahah. I tried the same on the Motorola Milestone 2 (A953) and experienced the same problem.

    Too bad. :'|

  2. wow, didn't notice the date my goodness this post is 2 years old.