[Bug 1270913] Re: zram-config doesn't start if zram is built-in, not module
stuart naylor
1270913 at bugs.launchpad.net
Mon Mar 4 22:45:33 UTC 2019
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:-
*******************************************************************
# 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.
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?
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to zram-config in Ubuntu.
https://bugs.launchpad.net/bugs/1270913
Title:
zram-config doesn't start if zram is built-in, not module
Status in zram-config package in Ubuntu:
Confirmed
Bug description:
zram-config works only if zram is compiled as module, if built-in then
modinfo zram | grep -q ' zram_num_devices:' 2>/dev/null;
and
modinfo zram | grep -q ' num_devices:' 2>/dev/null;
from file /etc/init/zram-config.conf returns false.
Looks like check should be another, proper check for zram
availability.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/zram-config/+bug/1270913/+subscriptions
More information about the foundations-bugs
mailing list