systemd / zram-generator

Systemd unit generator for zram devices
MIT License
575 stars 48 forks source link

Allow setting mem_limit #183

Open Lurux opened 1 year ago

Lurux commented 1 year ago

Being able to set /sys/block/zramX/mem_limit through the configuration file may be useful in situations where one wants to set a hard limit on the (compressed) size a given zram disk is going to take in memory.

As an example, I wanted to set up a large zram swap and limit it to use at most 25% of my total memory once compressed, but it seems like it isn't possible with just the configuration file currently.


As a side question, is it acceptable to set this manually by echoing my limit into /sys/block/zramX/mem_limit in the meantime, or could this cause some conflicts with zram-generator ?

nabijaczleweli commented 1 year ago

Yeah, you can set whatever for the device in sysfs; zram-generator is one-time setup.