Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions zram
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
# of system RAM to allocate to ZRAM block devices
# Too big, and your system will start killing off processes
FACTOR=33

# Compression method listed in /sys/block/zram0/comp_algorithm
# Set to empty to stay with default
COMP_ALG=lzo
2 changes: 2 additions & 0 deletions zramstart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ mem_by_cpu=$(($memtotal/$num_cpus*$factor/100*1024))
modprobe -q zram num_devices=$num_cpus

for i in $(seq 0 $last_cpu); do
[ -z $COMP_ALG ] || echo $COMP_ALG > /sys/block/zram$i/comp_algorithm
echo $mem_by_cpu > /sys/block/zram$i/disksize

mkswap /dev/zram$i
swapon -p 100 /dev/zram$i
done
3 changes: 1 addition & 2 deletions zramstat
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
ls /sys/block/zram* > /dev/null 2>&1 || exit 0

for i in /sys/block/zram*; do
compr=$(< $i/compr_data_size)
orig=$(< $i/orig_data_size)
read orig compr rest < $i/mm_stat
ratio=0
if [ $compr -gt 0 ]; then
ratio=$(echo "scale=2; $orig*100/$compr" | bc -q)
Expand Down