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

RFE: default settings for all zram devices #113

Open
Mek101 opened this issue Oct 22, 2021 · 11 comments
Open

RFE: default settings for all zram devices #113

Mek101 opened this issue Oct 22, 2021 · 11 comments
Labels
enhancement New feature or request

Comments

@Mek101
Copy link

Mek101 commented Oct 22, 2021

Having to specify a [zramN] section for each CPU core can extremely redundant on machines with many cores. Would it be possible to add a [default] section, to set the configuration of all devices, unless it's specifically overridden by the section of the single device?

@ignatenkobrain
Copy link
Member

Not too much related to the issue itself, but I'm curious…

section for each CPU core

What's the reason for this?

@vilgotf
Copy link
Contributor

vilgotf commented Oct 22, 2021

I think they're referring to old versions of Zram that didn't do multi core (fixad as of 3.15). docs.

@Mek101
Copy link
Author

Mek101 commented Oct 22, 2021

I'm talking about the structure of zram-generator config file

@nabijaczleweli
Copy link
Collaborator

nabijaczleweli commented Oct 22, 2021

Sure, but beside the RFE (which I find rather superfluous, seeing as printf '[zram%d]\nzram-fraction = 0.017\n\n' $(seq $(nproc)) > /etc/systemd/zram-generator.conf works), why do you want to generate 112 zram devices instead of, like, just one 112 times as large?

@Mek101
Copy link
Author

Mek101 commented Oct 22, 2021

What


Sorry mobile formatting made everything illegible

@Mek101
Copy link
Author

Mek101 commented Oct 22, 2021

(which I find rather superfluous, seeing as printf '[zram%d]\nzram-fraction = 0.017\n\n' $(seq $(nproc)) > /etc/systemd/zram-generator.conf works

Works until you have to update something and you have 1 or 2 devices with a different configuration, then you have to copy those different configs away, generate a new file file and repatch it

why do you want to generate 112 zram devices instead of, like, just one 112 times as large?

Parallelism

@nabijaczleweli
Copy link
Collaborator

Is this, like, measurable? I don't really believe you're gonna get more/better/faster processing by doing smaller batches.

@keszybz
Copy link
Member

keszybz commented Oct 24, 2021

From the kernel docs quoted by @vilgotf:

Regardless of the value passed to this attribute, ZRAM will always allocate multiple compression streams - one per online CPU - thus allowing several concurrent compression operations.

@keszybz
Copy link
Member

keszybz commented Nov 2, 2021

To summarize: the original motivation was apparently to have multiple devices to allow parallellization, which actually is implemented internally in the kernel. Nevertheless, the approach to have default settings could be useful to some extent, e.g. for mount points. But I would like to see some actual use case before adding new functionality.

@keszybz keszybz changed the title Feature request: default settings for all zram devices RFE: default settings for all zram devices Nov 2, 2021
@nabijaczleweli nabijaczleweli added the enhancement New feature or request label Dec 6, 2021
@610th
Copy link
Contributor

610th commented Jan 7, 2022

I hijack this issue with a related thing.

I'm quite lazy and stupid, so I just copied mount-point = /var/tmp from the README when I specified mount-point in my zram-generator.conf. I suspect that this caused illegal permissions to be set to /var/tmp. It broke my flatpak (and probably many other things). Later I realized that the high quality hack actually applied to me. I don't know much about systemd and generators (nor am I eager to learn), I just wanted to get zram up and running ASAP and zram-generator seemed easy to use, plus I like Rust.

It might be wise to specify some different mount-point in the README. Why is /var/tmp being used? I bet I'm not the only one being lazy and stupid.

nabijaczleweli added a commit that referenced this issue Jan 7, 2022
This doesn't require hacking the mount unit, at least
(and /var/tmp must be persistent across boots)

Ref: #113
@nabijaczleweli
Copy link
Collaborator

This is a very good point (and /var/tmp is (supposed to be :v) guaranteed-persistent across boots). I've updated the README to point at /var/compressed instead of /var/tmp in the referenced commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

6 participants