New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem enabling zstd #50
Comments
Does this also happen when you run this as root? modprobe -r zram
modprobe zram
# Give it a moment to settle
echo 1 > /sys/block/zram0/reset
echo zstd > /sys/block/zram0/comp_algorithm
echo $NUMBER > /sys/block/zram0/disksize
/usr/lib/systemd/systemd-makefs swap /dev/zram0 (Substitute If so, pick another algorithm: does it also happen then? |
@nabijaczleweli Thanks for your help! |
Since aa03047 (which is included in the zram-generator version in F33, 0.2.0), we do |
Apparently the kernel sometimes doesn't load the appropriate compression algorithm (see systemd#50, systemd#53). Let's do an explicit modprobe call, similarly to what we do for the zram module itself. The operation is minimalistic, and we only load the modules for algs that were explicitly configured (on the assumption that the default alg has to be loaded already), and not known to the kernel. Hopefully fixes systemd#53.
Apparently the kernel sometimes doesn't load the appropriate compression algorithm (see systemd#50, systemd#53). Let's do an explicit modprobe call, similarly to what we do for the zram module itself. The operation is minimalistic, and we only load the modules for algs that were explicitly configured (on the assumption that the default alg has to be loaded already), and not known to the kernel. Hopefully fixes systemd#53.
Creation of a zram device (with zstd as the compression alg) occasionally fails with ENOMEM: Jan 13 09:59:39 vultr.guest systemd[1]: Starting Create swap on /dev/zram3... Jan 13 09:59:39 vultr.guest kernel: Can't allocate a compression stream Jan 13 09:59:39 vultr.guest kernel: zram: Cannot initialise zstd compressing backend Jan 13 09:59:39 vultr.guest zram-generator[997]: Error: Failed to configure disk size into /sys/block/zram3/disksize Jan 13 09:59:39 vultr.guest zram-generator[997]: Caused by: Jan 13 09:59:39 vultr.guest zram-generator[997]: Cannot allocate memory (os error 12) https://bugzilla.kernel.org/show_bug.cgi?id=211173 The kernel normally loads the compressor module when a device with a given compression module is loaded, but this doesn't always work. Apparently, loading the compression module up front avoids the issue. Fixes systemd#50, systemd#53. Note: /sys/block/zram0/comp_algorithm lists compressors known to zram, not the ones currently loaded. /proc/crypto lists currently loaded crypto & compression modules.
Creation of a zram device (with zstd as the compression alg) occasionally fails with ENOMEM: Jan 13 09:59:39 vultr.guest systemd[1]: Starting Create swap on /dev/zram3... Jan 13 09:59:39 vultr.guest kernel: Can't allocate a compression stream Jan 13 09:59:39 vultr.guest kernel: zram: Cannot initialise zstd compressing backend Jan 13 09:59:39 vultr.guest zram-generator[997]: Error: Failed to configure disk size into /sys/block/zram3/disksize Jan 13 09:59:39 vultr.guest zram-generator[997]: Caused by: Jan 13 09:59:39 vultr.guest zram-generator[997]: Cannot allocate memory (os error 12) https://bugzilla.kernel.org/show_bug.cgi?id=211173 The kernel normally loads the compressor module when a device with a given compression module is loaded, but this doesn't always work. Apparently, loading the compression module up front avoids the issue. Fixes systemd#50, systemd#53. Note: /sys/block/zram0/comp_algorithm lists compressors known to zram, not the ones currently loaded. /proc/crypto lists currently loaded crypto & compression modules.
When I remove the manual module loading, it seems to be still working. Thanks for your help! |
@darkdragon-001 if you could provide the debug information that the kernel devs requested in https://bugzilla.kernel.org/show_bug.cgi?id=211173, that'd be super cool. |
I tried to use
zstd
compression with zram on Fedora 33 with kernel5.8.14-300.fc33.x86_64
.Restarting via
sudo systemctl restart swap-create@zram0.service
gives me the following error:I also tried rebooting and the same problem occurs.
What is going on? Any help appreciated!
The text was updated successfully, but these errors were encountered: