-
Notifications
You must be signed in to change notification settings - Fork 28
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
Make algorithm_params
configurable
#43
Comments
I have not tried, but all shell-scripts involved in zram-init should be correct with spaces (that is, I would consider it a bug if they are not). In particular, it should not be a problem to do something like |
I don't think this would work. The |
I see; I got confused, because of the term I tagged the new version temporarily with 12.0 (this is not yet an official release) so that you can easily download. I would appreciate if you could test it if you have a corresponding kernel. (If it does not work, I will re-tag 12.0 once I got a working version.) |
I'm not quite sure why this attr accepts
Thanks! I'll test it on gentoo with unpatched v6.12.2 kernel tomorrow. zramctl --size "${size}MiB" \
${streams:+--streams "$streams"} \
+ ${params:+--params "$params"} \
${algo:+--algorithm "$algo"} ${1+"$@"} \ I'll make a PR with a few fixes now. |
Fixed in (re-tagged and released) v12.0. Please ping me or re-open when util-linux gets updated. |
I've confirmed that after patching #45 the parameters are successfully configurable. 🎉 $ zramctl /dev/zram0 # default (implicit level=3)
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 zstd 16G 2.1G 511.9M 525.7M 4 /tmp
$ zramctl /dev/zram0 # level=1
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 zstd 16G 2.1G 524.5M 538.7M 4 /tmp
$ zramctl /dev/zram0 # level=22
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 zstd 16G 2.1G 475.5M 488.8M 4 /tmp Also, unrelated to this issue, but on lvl22 I had time to observe something strange: even though there was |
In the modern kernels we have write-only
/sys/block/zram<id>/algorithm_params
files that can accept additional parameters for the selected algo, for example:Most notably, it allows us to set the compression level to achieve lower CPU load or better compression ratio.
Setting the params must be done before initializing the zram device (i.e. before setting
disksize
).It would be great to be able to set something like
in the zram-init config.
Refs: https://docs.kernel.org/admin-guide/blockdev/zram.html#set-compression-algorithm-parameters-optional, https://lore.kernel.org/linux-block/[email protected]/
The text was updated successfully, but these errors were encountered: