[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] mdfzhi:
# lowmemorykiller tweak.
/sbin/busybox echo "32" >> /sys/module/lowmemorykiller/parameters/cost
/sbin/busybox echo "0" >> /sys/module/lowmemorykiller/parameters/debug_level

# disk speed tweak.
MTD=`/sbin/busybox ls -d /sys/block/mtd*`
MMC=`/sbin/busybox ls -d /sys/block/mmc*`
ZRM=`/sbin/busybox ls -d /sys/block/zram*`

# Optimize non-rotating storage.
for i in $MTD $MMC $ZRM
do
# IMPORTANT!
if /sbin/busybox [ -e $i/queue/rotational ];
then
/sbin/busybox echo "0" >> $i/queue/rotational
fi;

if /sbin/busybox [ -e $i/queue/nr_requests ];
then
/sbin/busybox echo "8192" >> $i/queue/nr_requests
fi;

# CFQ specific.
if /sbin/busybox [ -e $i/queue/iosched/back_seek_penalty ];
then
/sbin/busybox echo "1" >> $i/queue/iosched/back_seek_penalty
fi;

if /sbin/busybox [ -e $i/queue/iosched/low_latency ];
then
/sbin/busybox echo "1" >> $i/queue/iosched/low_latency
fi;

if /sbin/busybox [ -e $i/queue/iosched/slice_idle ];
then
/sbin/busybox echo "0" >> $i/queue/iosched/slice_idle
fi;

if /sbin/busybox [ -e $i/queue/iosched/quantum ];
then
/sbin/busybox echo "8" >> $i/queue/iosched/quantum
fi;

# Deadline/VR/SIO specific.
if /sbin/busybox [ -e $i/queue/iosched/fifo_batch ];
then
/sbin/busybox echo "1" >> $i/queue/iosched/fifo_batch
fi;

if /sbin/busybox [ -e $i/queue/iosched/writes_starved ];
then
/sbin/busybox echo "1" >> $i/queue/iosched/writes_starved
fi;

# VR Specific.
if /sbin/busybox [ -e $i/queue/iosched/rev_penalty ];
then
/sbin/busybox echo "1" >> $i/queue/iosched/rev_penalty
fi;

if /sbin/busybox [ -e $i/queue/rq_affinity ];
then
/sbin/busybox echo "1" >> $i/queue/rq_affinity
fi;
done;

# disable iostats to reduce overhead.
for k in $MTD $MMC $ZRM
do
if /sbin/busybox [ -e $i/queue/iostats ];
then
/sbin/busybox echo "0" >> $k/queue/iostats
fi;
done;

# defend against arp spoofing.
# Turn on Source Address Verification in all interfaces.
/sbin/busybox echo "1" >> /proc/sys/net/ipv4/conf/all/rp_filter
/sbin/busybox echo "1" >> /proc/sys/net/ipv4/conf/default/rp_filter
# Do not accept ICMP redirects.
/sbin/busybox echo "0" >> /proc/sys/net/ipv4/conf/all/accept_redirects
/sbin/busybox echo "0" >> /proc/sys/net/ipv4/conf/default/accept_redirects
# Do not send ICMP redirects.
/sbin/busybox echo "0" >> /proc/sys/net/ipv4/conf/all/send_redirects
/sbin/busybox echo "0" >> /proc/sys/net/ipv4/conf/default/send_redirects
# Ignore ICMP broadcasts will stop gateway from responding to broadcast pings.
/sbin/busybox echo "1" >> /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
# Ignore bogus ICMP errors.
/sbin/busybox echo "1" >> /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
# Do not accept IP source route packets.
/sbin/busybox echo "0" >> /proc/sys/net/ipv4/conf/all/accept_source_route
/sbin/busybox echo "0" >> /proc/sys/net/ipv4/conf/default/accept_source_route
# Turn on log Martian Packets with impossible addresses.
/sbin/busybox echo "1" >> /proc/sys/net/ipv4/conf/all/log_martians
/sbin/busybox echo "1" >> /proc/sys/net/ipv4/conf/default/log_martians

# optimize network.
/sbin/busybox echo "2097152" >> /proc/sys/net/core/wmem_max
/sbin/busybox echo "2097152" >> /proc/sys/net/core/rmem_max
/sbin/busybox echo "20480" >> /proc/sys/net/core/optmem_max
/sbin/busybox echo "1" >> /proc/sys/net/ipv4/tcp_moderate_rcvbuf
/sbin/busybox echo "6144" >> /proc/sys/net/ipv4/udp_rmem_min
/sbin/busybox echo "6144" >> /proc/sys/net/ipv4/udp_wmem_min
/sbin/busybox echo "6144 87380 2097152" >> /proc/sys/net/ipv4/tcp_rmem
/sbin/busybox echo "6144 87380 2097152" >> /proc/sys/net/ipv4/tcp_wmem
/sbin/busybox sysctl -w net.ipv4.tcp_timestamps=0
/sbin/busybox sysctl -w net.ipv4.tcp_tw_reuse=1
/sbin/busybox sysctl -w net.ipv4.tcp_tw_recycle=1
/sbin/busybox sysctl -w net.ipv4.tcp_sack=1
/sbin/busybox sysctl -w net.ipv4.tcp_window_scaling=1
/sbin/busybox sysctl -w net.ipv4.tcp_keepalive_probes=5
/sbin/busybox sysctl -w net.ipv4.tcp_ecn=0
/sbin/busybox sysctl -w net.ipv4.tcp_max_tw_buckets=360000
/sbin/busybox sysctl -w net.ipv4.tcp_synack_retries=2
/sbin/busybox sysctl -w net.ipv4.route.flush=1
/sbin/busybox sysctl -w net.ipv4.icmp_echo_ignore_all=1
/sbin/busybox sysctl -w net.ipv4.conf.all.rp_filter=1
/sbin/busybox sysctl -w net.ipv4.tcp_synack_retries=2
/sbin/busybox sysctl -w net.ipv4.tcp_syn_retries=2
/sbin/busybox sysctl -w net.ipv4.tcp_no_metrics_save=1
/sbin/busybox sysctl -w net.ipv4.tcp_fin_timeout=15
/sbin/busybox sysctl -w net.ipv4.tcp_keepalive_intvl=60
/sbin/busybox sysctl -w net.ipv4.tcp_keepalive_time=1800
/sbin/busybox sysctl -w net.ipv4.conf.all.secure_redirects=0
/sbin/busybox sysctl -w net.ipv4.conf.default.secure_redirects=0

/sbin/busybox sysctl -w net.core.wmem_max=524288
/sbin/busybox sysctl -w net.core.rmem_max=524288
/sbin/busybox sysctl -w net.core.rmem_default=110592
/sbin/busybox sysctl -w net.core.wmem_default=110592

# tweak various kernel memory settings.
/sbin/busybox sysctl -w kernel.threads-max=10000
/sbin/busybox sysctl -w fs.file-max=65536
/sbin/busybox sysctl -w fs.lease-break-time=10
/sbin/busybox sysctl -w vm.dirty_ratio=80
/sbin/busybox sysctl -w vm.dirty_background_ratio=60
/sbin/busybox sysctl -w vm.vfs_cache_pressure=101
/sbin/busybox sysctl -w vm.oom_kill_allocating_task=0
/sbin/busybox sysctl -w vm.min_free_kbytes=2048
/sbin/busybox sysctl -w vm.dirty_expire_centisecs=2000
/sbin/busybox sysctl -w vm.dirty_writeback_centisecs=1000
/sbin/busybox sysctl -w vm.panic_on_oom=0
/sbin/busybox sysctl -w vm.overcommit_memory=1
/sbin/busybox sysctl -w vm.overcommit_ratio=40
/sbin/busybox sysctl -w vm.swappiness=30
/sbin/busybox sysctl -w kernel.panic_on_oops=0
/sbin/busybox sysctl -w kernel.panic=0

# frandom kernel random number generator.
if /sbin/busybox [ -e /dev/erandom ] && /sbin/busybox [ -e /dev/frandom ];
then
/sbin/busybox chmod 0444 /dev/erandom
/sbin/busybox chmod 0444 /dev/frandom
/sbin/busybox rm -f /dev/random
/sbin/busybox rm -f /dev/urandom
/sbin/busybox ln -s /dev/erandom /dev/random
/sbin/busybox ln -s /dev/erandom /dev/urandom
/sbin/havege -w 4096 -s /dev/erandom
fi;

/sbin/busybox sysctl -w kernel.random.read_wakeup_threshold=4096

stable enough for me, and my favorite jb rom too. got all features from cm10, aokp jb and pa jb mashed up in one rom.

im talking about pacman v19, not the v20.