-
Notifications
You must be signed in to change notification settings - Fork 41
udev: Use arch linux wiki zram rules #138
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
base: master
Are you sure you want to change the base?
udev: Use arch linux wiki zram rules #138
Conversation
usr/lib/udev/rules.d/30-zram.rules
Outdated
| # Based on https://wiki.archlinux.org/title/Zram#Optimizing%20swap%20on%20zram | ||
| SYSCTL{vm.watermark_boost_factor}="0" | ||
| SYSCTL{vm.watermark_scale_factor}="125" | ||
| SYSCTL{vm.page-cluster}="0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already set via sysctl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is just vm.page-cluster? because vm.watermark_scale_factor i can't found in usr/lib/sysctl.d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that isn't set yet. I think I'm generally fine with it, considering some other distro is shipping it. Can you move it to the sysctl file tho? It's more appropriate to place it there.
@ventureoo thoughts on settings vm.watermark_scale_factor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have removed this since this increased the ram usage (cache) like x2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have removed this since this increased the ram usage (cache) like x2
sorry, this means that is best to not set it? and just increase zram in 180?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or this parameter can be set when just using zram?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We currently set swapiness to 150, as you see in the below comment. Im unsure, if 180 will make a huge difference?
You can also test yourself with the above values - they go way over the roof. We have debugged this "issue" very long time, till we found this is coming from there.
This was removed in commit 451836f (#55)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in my test looks that zram usage is more than using 150, idk if this are a placebo effect, but this makes zram be used more early when running applications that uses high ram. i has reduced zram priority from 100 to 0 too.
I think that can be good if has more results, but for now can be just priority or a placebo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that isn't set yet. I think I'm generally fine with it, considering some other distro is shipping it. Can you move it to the sysctl file tho? It's more appropriate to place it there.
@ventureoo thoughts on settings
vm.watermark_scale_factor?
To be honest, I'm not sure. Basiclly that is just makes kswapd less aggressive when RAM usage is low, and in turn it actually increases memory consumption since most of unused pages stay in memory. This is positive effect for CPU in case of ZRAM and makes some users happy, because they don't like earlier swap usage for whatever reason, but on other hand creates discomfort for others as the increase can be quite large [1]. Probably we just need to pick a some reasonably balanced value, as we have done with other non-obvious parameters.
I also want to separately note that kswapd is not only about swap, but also about freeing unused file pages, i.e. flushing page cache, which is in my view the main reason for the increased consumption here even when there are no pages that actually need to be swapped into ZRAM.
usr/lib/udev/rules.d/30-zram.rules
Outdated
| SYSCTL{vm.swappiness}="180" | ||
|
|
||
| # Based on https://wiki.archlinux.org/title/Zram#Optimizing%20swap%20on%20zram | ||
| SYSCTL{vm.watermark_boost_factor}="0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already disabled in the kernel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you, i has made a forced push to remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already disabled in the kernel.
Well, actually it's not. It's just we have patch that enables it by default, but user can use other kernels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already disabled in the kernel.
Well, actually it's not. It's just we have patch that enables it by default, but user can use other kernels.
Yeah, that's what I meant. Do we really want to care about other kernels though? It's far more likely that outside users would use the kernel more than our settings. There's a high chance that their already using our kernel too when they opt to use our settings. Other kernels such as zen and tkg also disable this via patch too AFAIK.
|
The zram rules are handled here: The reason for this, is to only apply the changes, when zram is found. |
thank you, i has added in this file 30-zram.rules |
c9995a8 to
429f037
Compare
from: https://wiki.archlinux.org/title/Zram#Optimizing%20swap%20on%20zram
"Explanation of the configuration:
These values are what Pop!_OS uses. That Pop!_OS GitHub pull request also links to some testing done by users on r/Fedora, which determined that vm.page-cluster = 0 is ideal. They also found a high swappiness value to be ideal, which matches what is suggested by the kernel docs:
On a system with a hard drive, random I/O against the zswap device would be orders of magnitude faster than I/O against the filesystem, so swappiness should be ~200. Even on a system with a fast SSD, a high swappiness value may be ideal." - Arch Wiki