"num_devices parameter is optional and tells zram how many devices should be
pre-created. Default: 1"
The whole first procedure is a question to why and completely fails to check previous devices or modprobe zram services:-
*******************************************************************
# load dependency modules
if grep ZRAM=m /boot/config-$(uname -r)
NRDEVICES=$(grep -c ^processor /proc/cpuinfo | sed 's/^0$/1/')
if modinfo zram | grep -q ' zram_num_devices:' 2>/dev/null; then
MODPROBE_ARGS="zram_num_devices=${NRDEVICES}"
elif modinfo zram | grep -q ' num_devices:' 2>/dev/null; then
MODPROBE_ARGS="num_devices=${NRDEVICES}"
else
exit 1
fi
modprobe zram $MODPROBE_ARGS
fi
*****************************************************************
zram can be easily checked to see if it has a sys class
ZRAM_SYS_DIR='/sys/class/zram-control'
if [ ! -d "${ZRAM_SYS_DIR}" ]; then
if not then modprobe zram will create it.
So after a modprobe zram all you have to do is create first device /dev/zram0
As cat /sys/class/zram-control/hot_add will always contain the next device number and will already contain '1'
After that
RAM_DEV=$(cat /sys/class/zram-control/hot_add)
echo ${COMP_ALG_SWAP} > /sys/block/zram${RAM_DEV}/comp_algorithm
echo ${mem} > /sys/block/zram${RAM_DEV}/disksize
mkswap /dev/zram${RAM_DEV}
swapon -p ${SWAP_PRI} /dev/zram${RAM_DEV}
is all that is needed as cat /sys/class/zram-control/hot_add is incremented on each addition
But then we have the questions of if a single device is automatically allocated streams for all cores why add a block device for each core?
Also zram can use all crypto listed in proc/crypto but its hard coded.
Same for swap priority & size setting.
https:/ /www.kernel. org/doc/ Documentation/ blockdev/ zram.txt
"num_devices parameter is optional and tells zram how many devices should be
pre-created. Default: 1"
The whole first procedure is a question to why and completely fails to check previous devices or modprobe zram services:- ******* ******* ******* ******* ******* ******* ******* ******* **** $(uname -r) ARGS="zram_ num_devices= ${NRDEVICES} " ARGS="num_ devices= ${NRDEVICES} " ******* ******* ******* ******* ******* ******* ******* ******* **
*******
# load dependency modules
if grep ZRAM=m /boot/config-
NRDEVICES=$(grep -c ^processor /proc/cpuinfo | sed 's/^0$/1/')
if modinfo zram | grep -q ' zram_num_devices:' 2>/dev/null; then
MODPROBE_
elif modinfo zram | grep -q ' num_devices:' 2>/dev/null; then
MODPROBE_
else
exit 1
fi
modprobe zram $MODPROBE_ARGS
fi
*******
zram can be easily checked to see if it has a sys class
if [ ! -d "${ZRAM_SYS_DIR}" ]; then
if not then modprobe zram will create it. zram-control/ hot_add will always contain the next device number and will already contain '1'
So after a modprobe zram all you have to do is create first device /dev/zram0
As cat /sys/class/
After that
RAM_DEV=$(cat /sys/class/ zram-control/ hot_add) zram${RAM_ DEV}/comp_ algorithm zram${RAM_ DEV}/disksize zram-control/ hot_add is incremented on each addition
echo ${COMP_ALG_SWAP} > /sys/block/
echo ${mem} > /sys/block/
mkswap /dev/zram${RAM_DEV}
swapon -p ${SWAP_PRI} /dev/zram${RAM_DEV}
is all that is needed as cat /sys/class/
But then we have the questions of if a single device is automatically allocated streams for all cores why add a block device for each core?
Also zram can use all crypto listed in proc/crypto but its hard coded.
Same for swap priority & size setting.
There is little correlation in the methods used in zram-config & https:/ /www.kernel. org/doc/ Documentation/ blockdev/ zram.txt and maybe someone should ask why?