[Galaxy Y GT-S5360 Android Development] whitexp:
zRAM

What is zRAM?

This is a mainline kernel feature for Compressed RAM block device support (CONFIG_ZRAM)

http://en.wikipedia.org/wiki/ZRam

Like many of the other tweaks done in the Android world, ZRAM is another one of them that is controversial, probably because people only think in terms of immediate performance they can measure easily with benchmarks etc. *Here is my take...think I will add this to the Q&A section as well.

But, will it make my device faster? Will I score higher on benchmarks?

It depends, but for normal usage, the answer is no. zRAM is most useful for those that are configuring Android to be a true multitasking workhorse. For example, if I enable zRAM, open an bunch of apps at one time, and actually start to work towards depleting the memory of the system. *For example, say I open system tuner, a browser with several tabs, a word processing app, a game, and perhaps a picture viewing app or a movie. If I don't formally close out of each one by hitting back and just begin switching between apps and the home screen, you will see zRAM start showing benefits.*

If you tweak the Android memory and swappiness settings, this can also be useful in this type of environment.

So, unless you have a heavy workload as stated above, then it won't be of a lot of use for the casual user.

How do I enable zram?

It must be enabled by a script. Some ROMs may support activating it. If you need to do it yourself you have two choices.

1) Save this to a file and run the script from terminal, Script Manager or System Tuner.

2) Or better yet, save this to a file called 90zram (or whatever you prefer) in /system/etc/init.d and automate it (The ROM's ramdisk needs to supports init.d)

#!/system/bin/sh
# auto zram activation init script with busybox search
# by show-p1984

echo "[90ZRAM]: Firing up /system/etc/init.d/90zram";

if [ ! -e /sys/block/zram0/disksize ] ; then
echo "[90ZRAM]: ERROR unable to find /sys/block/zram0/disksize";
echo "[90ZRAM]: Is this a ZRAM kernel?";
echo "[90ZRAM]: ZRAM NOT ACTIVATED. (404)";
else
#find busybox in /system
bblocation=$(find /system/ -name 'busybox')
if [ -n "$bblocation" ] && [ -e "$bblocation" ] ; then
echo "[90ZRAM]: busybox found in:" $bblocation;
echo "[90ZRAM]: Setting ZRAM disksize.";
echo $((100*1024*1024)) > /sys/block/zram0/disksize

echo "[90ZRAM]: Starting ZRAM...";
bblocation=${bblocation%/*}
cd $bblocation
./busybox mkswap /dev/block/zram0
./busybox swapon /dev/block/zram0

echo "[90ZRAM]: ZRAM activated.";
else
echo "[90ZRAM]: ERROR! busybox not found!";
echo "[90ZRAM]: Is busybox installed? Symlinks set?";
echo "[90ZRAM]: ZRAM NOT ACTIVATED. (404)";
fi
fi

Performance Tweaks

These are a couple of tweaks that many are using for faster benchmarks and better battery performance. Google it and decide for yourself if you like the risk or not. I recommend that you do a full backup in recovery and regularly backup your /data partion or cloud sync if you enable these options. Will many run them daily as I now do, there is some additional risk. These can be added to scripts and automated via init.d or other apps/tools that support them.

To disable fsync for better battery and better disk i/o performance:

echo 0 > /sys/class/misc/fsynccontrol/fsync_enabled

To enable fsync for better data integrity (default)

echo 1 > /sys/class/misc/fsynccontrol/fsync_enabled

Faster disk i/o - remount /data partition with noauto_da_alloc option (google it, better battery, less data integrity)

mount -o remount,noauto_da_alloc /data /data