Bug 1185928 - systemd-zram-service multicore handling is deprecated
systemd-zram-service multicore handling is deprecated
Classification: openSUSE
Product: openSUSE Distribution
Classification: openSUSE
Component: Other
Leap 42.3
Other Other
: P5 - None : Enhancement with 1 vote (vote)
: ---
Assigned To: Lubos Kocman
E-mail List
Depends on:
  Show dependency treegraph
Reported: 2021-05-11 15:39 UTC by Tiago Marques
Modified: 2022-09-07 01:27 UTC (History)
2 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Tiago Marques 2021-05-11 15:39:07 UTC
Upon installing 'systemd-zram-service', I noticed it is generating two ZRAM block devices for swap.

Further look at '/sys/block/zram0/max_comp_streams', shows '2' per block device, which is correct for my system.
This is in line with the use of "per CPU compression streams":


Currently the script is trying to do in parallel with ZRAM already having that baked in, even for the older LEAP kernel.
Per cpu number of streams is a significant performance improvement.

The simple fix is deleting the CPU count code and just setting 'num_cpus=1' on both scripts.
Comment 1 Chenzi Cao 2021-05-14 11:50:01 UTC
Hi Lubos, would you pelase take a look at this issue? I can not find a maintainer for package systemd-zram-service, thanks.
Comment 2 Archer Allstars 2022-08-30 23:23:00 UTC
I voted to make a change to this script, as creating zRAM devices based on the number of CPU cores can cause an issue too. See https://github.com/Nefelim4ag/systemd-swap/issues/176

It's a deprecated practice which can do more harm than good.

For anyone who want to fix this issue, you can do this by:

1. Open your file manager as an admin. Mine is: nautilus admin:///
2. Search for zramswapon file, edit the # get the number of CPUs to num_cpus=1.
3. Do the same for zramswapoff file.
4. Reboot your PC. Check zRAM with: sudo zramctl, now you should only have 1 zRAM device.
Comment 3 Archer Allstars 2022-09-02 01:52:12 UTC
I have created a request to change the systemd-zram-service package's zramswapon and zramswapoff scripts:

Comment 4 Archer Allstars 2022-09-07 01:03:45 UTC
Factory SR 1000767 (https://build.opensuse.org/request/show/1000767) was accepted. The fix is delivered with Tumbleweed's snapshot 20220905.
Comment 5 Archer Allstars 2022-09-07 01:27:08 UTC
Sorry, my bad, I see the package is updated when I `sudo zypper dup`. It's updated at the filesystem's repo but hasn't yet made it to the factory. Nevertheless, it should be delivered on Tumbleweed's snapshot soon.