Merge "Update script for new compcache module (ie: zram)" into gingerbread
This commit is contained in:
commit
9fe115c390
2 changed files with 10 additions and 6 deletions
|
@ -4,16 +4,17 @@
|
||||||
# shade@chemlab.org (cyanogen)
|
# shade@chemlab.org (cyanogen)
|
||||||
#
|
#
|
||||||
|
|
||||||
DEV=/dev/block/ramzswap0
|
DEV=/dev/block/zram0
|
||||||
MODULE=ramzswap
|
SYSFS_PATH=/sys/block/zram0
|
||||||
MODULES_DIR=/system/modules/lib/modules/`uname -r`
|
MODULE=zram
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
echo 3 > /proc/sys/vm/drop_caches
|
echo 3 > /proc/sys/vm/drop_caches
|
||||||
echo 30 > /proc/sys/vm/swappiness
|
echo 30 > /proc/sys/vm/swappiness
|
||||||
modprobe $MODULE
|
modprobe $MODULE
|
||||||
rzscontrol $DEV --disksize_kb=$2 --init
|
echo "$2" > $SYSFS_PATH/disksize
|
||||||
|
mkswap $DEV >/dev/null
|
||||||
swapon $DEV
|
swapon $DEV
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -22,7 +23,10 @@ case "$1" in
|
||||||
rmmod $MODULE >/dev/null 2>&1
|
rmmod $MODULE >/dev/null 2>&1
|
||||||
;;
|
;;
|
||||||
stats)
|
stats)
|
||||||
rzscontrol $DEV --stats
|
cd $SYSFS_PATH && for i in * ; do
|
||||||
|
echo -n "$i:"
|
||||||
|
cat $i
|
||||||
|
done
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: $0 {start <size>|stop|stats}"
|
echo "Usage: $0 {start <size>|stop|stats}"
|
||||||
|
|
|
@ -21,7 +21,7 @@ fi
|
||||||
|
|
||||||
if [ $PROP != 0 ]
|
if [ $PROP != 0 ]
|
||||||
then
|
then
|
||||||
CCSIZE=$(($(($MEMTOTAL * $PROP)) / 100))
|
CCSIZE=$(($(($MEMTOTAL * $PROP)) / 100 * 1024))
|
||||||
`dirname $0`/compcache start $CCSIZE
|
`dirname $0`/compcache start $CCSIZE
|
||||||
else
|
else
|
||||||
`dirname $0`/compcache stop
|
`dirname $0`/compcache stop
|
||||||
|
|
Loading…
Reference in a new issue