Skip to content
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

Can't to create more than one /dev/zram0 devices #16

Closed
igreenman opened this issue Jul 28, 2014 · 10 comments
Closed

Can't to create more than one /dev/zram0 devices #16

igreenman opened this issue Jul 28, 2014 · 10 comments

Comments

@igreenman
Copy link

Can't to create more than one /dev/zram0 devices.

no zram devices with uncommented zram[streams]=${sys[cpu_count]} in /etc/systemd-swap.conf

See bug FS#41361 in archlinux bugzilla.

@nefelim4ag
Copy link
Owner

This not a bug, check:
cat /sys/block/zram0/max_comp_streams
Official kernel documentation:
https://kernel.googlesource.com/pub/scm/linux/kernel/git/next/linux-next/+/refs/heads/akpm/Documentation/blockdev/zram.txt
quote:
2) Set max number of compression streams
Compression backend may use up to max_comp_streams compression streams,
thus allowing up to max_comp_streams concurrent compression operations.
By default, compression backend uses single compression stream.
Examples:
#show max compression streams number
cat /sys/block/zram0/max_comp_streams
#set max compression streams number to 3
echo 3 > /sys/block/zram0/max_comp_streams

@igreenman
Copy link
Author

Agree I'm a little confused.
The previous version was the option zram_num_devices=$cpu_count.
And even when the option was commented out was two zram devices.
The latest version is only one zram device. Is that correct?
The system has two CPUs.

@nefelim4ag
Copy link
Owner

Yes, previously i use several zram devices like https://aur.archlinux.org/packages/zramswap
After i found max_comp_streams options and rewrite some code for using kernel side feature.
And now, setup several zram devices for swap no needed, i can only set compression streams count with one zram device.

And even when the option was commented out was two zram devices. - if options commented and script setup several devices -> this is a bug of previously version.

The latest version is only one zram device. Is that correct?
The system has two CPUs.
Latest version setup only one device and if options for multi compression streams enabled, set 2 threads in max_comp_streams for your system.
This is right behavior.

@igreenman
Copy link
Author

About zram[streams] option.

  1. How to set max_comp_streams correctly systemwide?
  2. Not very logical that if in config zram[streams] more than max_comp_streams, then the zram device is not created.

@nefelim4ag
Copy link
Owner

  1. Systemwide? Only with hands :)
    echo | sudo tee /sys/block/zram*/max_comp_streams
  2. I repeat again, zram[streams] == max_comp_streams
    in script echo ${zram[streams]} > /sys/block/zram${[dev]}/max_comp_streams
    Value from zram[streams] sets to max_comp_streams
    if you set zram[streams]=4, after starting systemd-swap in max_comp_streams you have 4.
    We no need to create several device, 1 enough.
    Or in your system after set zram[streams]=4 zram device not setup? May be you not install zramctl? (this is external depends for systemd-swap, and this heeded for setups zram devices in script)

@igreenman
Copy link
Author

FS#41361:
no zram devices with uncommented zram[streams]=${sys[cpu_count]} in /etc/systemd-swap.conf

And one /dev/zram0 with this string commented.

Second line means that zramctl is installed, isn't it?

@nefelim4ag
Copy link
Owner

I am confused, in arch bug tracker you create bug because my tool no setup zram devices if you set streams count in config, on github you say what my tool must setup several device.

I retest on my system and all working perfect. If you have trouble please provide additional info, like steps for reproduce. Config copy paste, logs, some thing, what I can using for fix that.
one line command:
sudo bash -cx 'uname -a; modprobe --first-time zram; cd /etc/modprobe.d/; grep . *; ls /sys/block/; mount; swapon; zramctl status; cat /etc/systemd-swap.conf; bash -x /usr/lib/systemd/scripts/systemd-swap.sh stop; bash -x /usr/lib/systemd/scripts/systemd-swap.sh start; mount; swapon; zramctl status; ls /sys/block/; ls /sys/block/zram0/; strace zramctl find 1024M lz4 4;' &> ~/systemd-swap.log

@nefelim4ag
Copy link
Owner

if you using kernel => 3.15 and not set zram[alg] option, and set zram[streams] - you can get case where zramctl can't work properly, i fix that in 2.24.5

@igreenman
Copy link
Author

I apologize for the delay. I do not have access to the system right now.
Yes, the system has been in up to date conditions of a week ago (kernel ~3.15.5)
And I did not set zram[alg] option.
Thank you.

@nefelim4ag
Copy link
Owner

Happy to help, so can you close issue and bug report? https://bugs.archlinux.org/task/41361

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants