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

udev: Tune ZRAM rules for better performance #30

Merged
merged 2 commits into from
Sep 5, 2023

Conversation

ventureoo
Copy link
Member

Since we ship zram by default via zram-generator, I think we should do some extra tuning through new zramtune service.

This service performs:

  • Set the vm.swappiness value to 150. We need to push anonymous pages out more, once they are located in ZRAM.
  • Setting idle pages re-compression (we used to have this in an udev rule, but it didn't seem to work properly).
  • Set vm.watermark_scaling_factor parameter as recommended here:
    https://www.reddit.com/r/linux_gaming/comments/vla9gd/comment/ie1cnrh/

The list of changes is not too long, but it creates a convenient opportunity to define ZRAM-specific settings later on.

@ventureoo ventureoo requested a review from ptr1337 August 20, 2023 12:22
@ventureoo ventureoo marked this pull request as draft August 20, 2023 14:48
@ventureoo ventureoo changed the title Add zramtune service udev: Tune ZRAM rules for better performance Aug 20, 2023
@ventureoo
Copy link
Member Author

v2: I decided that the way of applying parameter values via a service for systemd is not good enough (the dependency on zram-generator services probably doesn't work the way as I expected), so I just modified the existing udev rules.

@ventureoo ventureoo marked this pull request as ready for review August 20, 2023 16:43
@Boria138
Copy link

Since we ship zram by default via zram-generator, I think we should do some extra tuning through new zramtune service.

This service performs:

* Set the `vm.swappiness` value to 150. We need to push anonymous pages out more, once they are located in ZRAM.

* Setting idle pages re-compression (we used to have this in an udev rule, but it didn't seem to work properly).

* Set `vm.watermark_scaling_factor` parameter as recommended here:
  https://www.reddit.com/r/linux_gaming/comments/vla9gd/comment/ie1cnrh/

The list of changes is not too long, but it creates a convenient opportunity to define ZRAM-specific settings later on.

If I don't confuse anything, watermarks can be turned off in vain, as here

zen-kernel/zen-kernel@4042133

@ventureoo
Copy link
Member Author

Since we ship zram by default via zram-generator, I think we should do some extra tuning through new zramtune service.
This service performs:

* Set the `vm.swappiness` value to 150. We need to push anonymous pages out more, once they are located in ZRAM.

* Setting idle pages re-compression (we used to have this in an udev rule, but it didn't seem to work properly).

* Set `vm.watermark_scaling_factor` parameter as recommended here:
  https://www.reddit.com/r/linux_gaming/comments/vla9gd/comment/ie1cnrh/

The list of changes is not too long, but it creates a convenient opportunity to define ZRAM-specific settings later on.

If I don't confuse anything, watermarks can be turned off in vain, as here

zen-kernel/zen-kernel@4042133

We don't ship the latest patches from Zen in our kernel. This patch also does the same thing as setting sycstl vm.watermark_boost_factor=0, which is already included in 21f5ee4. Maybe we should disable this also for non-ZRAM users, but I'll want to leave it that way for now.

@Boria138
Copy link

Since we ship zram by default via zram-generator, I think we should do some extra tuning through new zramtune service.
This service performs:

* Set the `vm.swappiness` value to 150. We need to push anonymous pages out more, once they are located in ZRAM.

* Setting idle pages re-compression (we used to have this in an udev rule, but it didn't seem to work properly).

* Set `vm.watermark_scaling_factor` parameter as recommended here:
  https://www.reddit.com/r/linux_gaming/comments/vla9gd/comment/ie1cnrh/

The list of changes is not too long, but it creates a convenient opportunity to define ZRAM-specific settings later on.

If I don't confuse anything, watermarks can be turned off in vain, as here

zen-kernel/zen-kernel@4042133

We don't ship the latest patches from Zen in our kernel. This patch also does the same thing as setting sycstl vm.watermark_boost_factor=0, which is already included in 21f5ee4. Maybe we should disable this also for non-ZRAM users, but I'll want to leave it that way for now.

I attached the Linux zen commit so that you could read the note to it because if I understood it correctly (which may be wrong but still) the vm.watermark_boost_factor=0 parameter completely disables watermarks so there is no point in vm.watermark_scale_factor, again I may be mistaken

@ventureoo
Copy link
Member Author

Since we ship zram by default via zram-generator, I think we should do some extra tuning through new zramtune service.
This service performs:

* Set the `vm.swappiness` value to 150. We need to push anonymous pages out more, once they are located in ZRAM.

* Setting idle pages re-compression (we used to have this in an udev rule, but it didn't seem to work properly).

* Set `vm.watermark_scaling_factor` parameter as recommended here:
  https://www.reddit.com/r/linux_gaming/comments/vla9gd/comment/ie1cnrh/

The list of changes is not too long, but it creates a convenient opportunity to define ZRAM-specific settings later on.

If I don't confuse anything, watermarks can be turned off in vain, as here
zen-kernel/zen-kernel@4042133

We don't ship the latest patches from Zen in our kernel. This patch also does the same thing as setting sycstl vm.watermark_boost_factor=0, which is already included in 21f5ee4. Maybe we should disable this also for non-ZRAM users, but I'll want to leave it that way for now.

I attached the Linux zen commit so that you could read the note to it because if I understood it correctly (which may be wrong but still) the vm.watermark_boost_factor=0 parameter completely disables watermarks so there is no point in vm.watermark_scale_factor, again I may be mistaken

This parameter only disables watermark boosting, not watermarks in general. As said in kernel documentation:

A boost factor of 0 will disable the feature.

https://www.kernel.org/doc/html/latest/admin-guide/sysctl/vm.html

@Boria138

This comment was marked as off-topic.

@ventureoo

This comment was marked as off-topic.

@Boria138

This comment was marked as off-topic.

@ventureoo

This comment was marked as off-topic.

@ventureoo ventureoo merged commit 2c24bc9 into CachyOS:master Sep 5, 2023
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

Successfully merging this pull request may close these issues.

2 participants