wok-current diff linux-zram/stuff/compcache @ rev 22019
linld: ipxe support (again)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Oct 19 21:09:13 2019 +0200 (2019-10-19) |
parents | 7f188676b59c |
children | ac1cbda6d814 |
line diff
1.1 --- a/linux-zram/stuff/compcache Thu May 26 20:16:45 2016 +0300 1.2 +++ b/linux-zram/stuff/compcache Sat Oct 19 21:09:13 2019 +0200 1.3 @@ -17,12 +17,18 @@ 1.4 exit 1 1.5 fi 1.6 action 'Loading module...' 1.7 - modprobe zram zram_num_devices=1 && 1.8 - [ -n "$SIZE_KB" ] && echo $(($SIZE_KB * 1024)) > /sys/block/zram0/disksize 1.9 + devices=$(awk '/cpu cores/{c=$4} /processor/{p++} 1.10 + END { if (c>0) p=c; if (p==0) p++; print p }' /proc/cpuinfo) 1.11 + modprobe zram zram_num_devices=$devices && 1.12 + [ -n "$SIZE_KB" ] && for i in $(seq 0 $(($devices-1))); do 1.13 + echo $(($SIZE_KB * 1024 / $devices)) > /sys/block/zram$i/disksize 1.14 + done 1.15 status 1.16 1.17 action 'Starting %s: %s...' "$DESC" $NAME 1.18 - mkswap /dev/zram0 && swapon /dev/zram0 -p 100 1.19 + for i in $(seq 0 $(($devices-1))); do 1.20 + mkswap /dev/zram$i && swapon /dev/zram$i -p 100 1.21 + done 1.22 status 1.23 ;; 1.24 stop) 1.25 @@ -31,7 +37,9 @@ 1.26 exit 1 1.27 fi 1.28 action 'Stopping %s: %s...' "$DESC" $NAME 1.29 - swapoff /dev/zram0 && echo 1 > /sys/block/zram0/reset 1.30 + for i in $(cd /sys/block/; ls -d zram*); do 1.31 + swapoff /dev/$i && echo 1 > /sys/block/$i/reset 1.32 + done 1.33 status 1.34 action 'Unloading module...' 1.35 rmmod zram