Sunday, April 10, 2011

Not so universal for original Droid

I was recently approached by Jason at Droidforums to see if I can make a zip for my tweaks for Droid 1.  Working with him closely (since I don't have a D1) I was able to come up with a slightly crippled version of my mods for Droid 1 running Project Elite ROM (but it should work for any ROMs that have init.d support).

Download

To check to see if the mods are working: open Terminal Emulator and type "bash /system/etc/imoseyon/checkimosey.sh" without quotes.

I'll try my best to further enhance the mods but I'll need some help from other D1 users. :)

Tuesday, April 5, 2011

minimal kernel for tbolt

Been messing with compiling kernels for my thunderbolt.  You can read about it here: http://goo.gl/hmhyb

More details on this later.  Combing through the kernel code for more tweaking opportunities. ;)

Friday, April 1, 2011

Why swap?

Why not?  ;)  If you think with 768MB of RAM on the thunderbolt you'd have way more memory than you'd ever need, then think again.  A lot of the memory is taken up by cache and buffers, which are also used pretty heavily with my tweaks.

For those of you that are new to Linux (or other UNIX variants), you'd probably heard the term "virtual memory".  Swap is pretty much that - a way to extend your physical memory.  Your OS moves the less accessed memory pages to slower, and cheaper storage medium.  This frees up RAM for things that require the speed.  And guess what? On almost all android devices you'll find tons of flash memory which are going to provide near RAM access speed for your swap space.

But setting up swap alone isn't going to do much.  In fact, it could do more harm than good.  You'd also want to adjust some OS/kernel related settings so your phone/device can use swap effectively.

You want to primarily look at two settings: vm.swappiness and minfree.

vm.swappiness is a no brainer.  The lower the number less swap the OS is going to use, the higher the more swap.  If you set it to 0 it's not going to use swap at all, 100 it's going to use a lot of swap.  If you set it to say 1 it would use swap only when absolutely necessary.  I recommend 40 on a 200MB swap file.

minfree is another tricky one.  To really get the full benefit of swap, I think you want minfree to "work less", ie. kill active and semi-active apps less frequently.  This will allow all of your frequently used apps to stay in RAM.  Something like this would work well:

echo "100,200,20000,20000,20000,25000" > /sys/module/lowmemorykiller/parameters/minfree

Finally, you'd need a kernel that supports swap.  Unfortunately if your bootloader is locked (ie. DX/D2) you're not going to get custom kernels that will support swap.  I've tested swap on some custom kernels on the Tbolt and the Gtab and it works well.  If you're running a kernel that supports swap, download and flash my zip to create and enable swap; the zip will also adjust swappiness and minfree accordingly if swap is enabled.

One final note on this is some technical stuff on why I chose to use internal flash for swap rather than the sdcard - internal flash performs better:
sh-3.2# hdparm -Tt /dev/block/mmcblk0p26


/dev/block/mmcblk0p26:
Timing buffer-cache reads: hdparm: HDIO_DRIVE_CMD: Inappropriate ioctl for device
  326 MB in 0.51 seconds = 653840 kB/s
Timing buffered disk reads:   52 MB in 3.01 seconds = 17683 kB/s
hdparm: HDIO_DRIVE_CMD: Inappropriate ioctl for device
sh-3.2# hdparm -Tt /dev/block/vold/179:33


/dev/block/vold/179:33:
Timing buffer-cache reads: hdparm: HDIO_DRIVE_CMD: Inappropriate ioctl for device
  218 MB in 0.51 seconds = 437047 kB/s
Timing buffered disk reads:   15 MB in 3.03 seconds = 5054 kB/s
hdparm: HDIO_DRIVE_CMD: Inappropriate ioctl for device

sh-3.2# time busybox dd if=/dev/zero of=/mnt/sdcard/test bs=1k count=100000
100000+0 records in
100000+0 records out


real    0m17.159s
user    0m0.070s
sys    0m2.710s
sh-3.2# time busybox dd if=/dev/zero of=/data/test bs=1k count=100000     
100000+0 records in
100000+0 records out


real    0m12.202s
user    0m0.100s
sys    0m2.960s