diff options
author | Dirk | 2012-12-16 16:12:35 +0100 |
---|---|---|
committer | Dirk | 2012-12-16 16:12:35 +0100 |
commit | 901c955f6948cadc97472aa4323645f63e06e2ab (patch) | |
tree | 98d8ffaa947fefee2c0780c4c96fa94db9d6ec0c | |
parent | Stuff for virtualbox configuration. (diff) | |
download | core-901c955f6948cadc97472aa4323645f63e06e2ab.tar.gz core-901c955f6948cadc97472aa4323645f63e06e2ab.tar.xz core-901c955f6948cadc97472aa4323645f63e06e2ab.zip |
Use zram if available (assign a quarter for compressed ram swap)
-rwxr-xr-x | src/initramfs/scripts/bin/hwautocfg | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/initramfs/scripts/bin/hwautocfg b/src/initramfs/scripts/bin/hwautocfg index 482c9f9a..3548abaa 100755 --- a/src/initramfs/scripts/bin/hwautocfg +++ b/src/initramfs/scripts/bin/hwautocfg @@ -1,6 +1,6 @@ #!/bin/sh # Copyright (c) 2003..2006 - RZ Uni Freiburg -# Copyright (c) 2006..2011 - OpenSLX GmbH +# Copyright (c) 2006..2012 - OpenSLX GmbH # # This program is free software distributed under the GPL version 2. # See http://openslx.org/COPYING @@ -277,12 +277,18 @@ case $1 in # disk setup part (detecting general id82,83 and slx id44,45,46, formatting # if required and mounting) disk) - # try to enable compressed RAM SWAP + # try to enable compressed RAM SWAP / ZRAM if modprobe ${MODPRV} ramzswap 2>/dev/null && [ -f /usr/bin/rzscontrol ] ; then mdev -s rzscontrol /dev/ramzswap0 --init - swapon /dev/ramzswap0 + swapon /dev/ramzswap0 2>/dev/null #hdswap="# disk swap disabled because of enabled compressed ramswap" + elif modprobe ${MODPRV} zram 2>/dev/null ; then + mdev -s + # assign a quarter of total mem to zram + echo $(( $(free -k | awk '/^Mem:/ { print $2 }') * 256 )) > /sys/block/zram0/disksize + mkswap /dev/zram0 2>/dev/null + swapon /dev/zram0 2>/dev/null fi # if disk action is not disabled if [ "x${hw_local_disk}" != "xno" ] ; then |