Closed ventureoo closed 1 year ago
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.
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
https://github.com/zen-kernel/zen-kernel/commit/40421337ba78f6ceb6a26142c9ff5e35d03309b
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
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 https://github.com/CachyOS/CachyOS-Settings/pull/30/commits/21f5ee40d2dd434f775c97836db3304c6cf35988. Maybe we should disable this also for non-ZRAM users, but I'll want to leave it that way for now.
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
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 https://github.com/CachyOS/CachyOS-Settings/pull/30/commits/21f5ee40d2dd434f775c97836db3304c6cf35988. 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
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
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
Ok so I misunderstood how things work, but I'll continue the discussion a bit by asking if it makes sense to add the sysctl setting from this comit from linux-zen? https://github.com/zen-kernel/zen-kernel/commit/eb913977ddb0f962496a22075dc6c7b6989fde56
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
Ok so I misunderstood how things work, but I'll continue the discussion a bit by asking if it makes sense to add the sysctl setting from this comit from linux-zen? zen-kernel/zen-kernel@eb91397
This capability should have a positive impact on reducing latency when dealing with huge pages by compacting (defragmenting) them on demand in the background.
The reason why this was disabled in zen I can see:
1) The use of huge pages is not common on desktop.
2) The extra "daemon" running in the background creates overheads
3) Finally, although latency is reduced when working with huge pages, this process involves a large number of memory allocations
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
Ok so I misunderstood how things work, but I'll continue the discussion a bit by asking if it makes sense to add the sysctl setting from this comit from linux-zen? zen-kernel/zen-kernel@eb91397
This capability should have a positive impact on reducing latency when dealing with huge pages by compacting (defragmenting) them on demand in the background.
The reason why this was disabled in zen I can see:
1) The use of huge pages is not common on desktop.
2) The extra "daemon" running in the background creates overheads
3) Finally, although latency is reduced when working with huge pages, this process involves a large number of memory allocations
After a little searching on archwiki, I found a similar warning about THP.
Note that if your game uses TCMalloc (e.g., Dota 2 and CS:GO) then it is not recommended to disable THP as it comes with a large performance cost. Instead if you enable THP, you might also want to enable proactive compaction.
So it looks like you can forget about my question since leaving it as is seems to be more beneficial than disabling it.
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
Ok so I misunderstood how things work, but I'll continue the discussion a bit by asking if it makes sense to add the sysctl setting from this comit from linux-zen? zen-kernel/zen-kernel@eb91397
This capability should have a positive impact on reducing latency when dealing with huge pages by compacting (defragmenting) them on demand in the background. The reason why this was disabled in zen I can see:
- The use of huge pages is not common on desktop.
- The extra "daemon" running in the background creates overheads
- Finally, although latency is reduced when working with huge pages, this process involves a large number of memory allocations
After a little searching on archwiki, I found a similar warning about THP.
Note that if your game uses TCMalloc (e.g., Dota 2 and CS:GO) then it is not recommended to disable THP as it comes with a large performance cost. Instead if you enable THP, you might also want to enable proactive compaction.
So it looks like you can forget about my question since leaving it as is seems to be more beneficial than disabling it.
Yeah, that's one of the reasons why we don't use zen patches except CFS tweaks.
Since we ship zram by default via zram-generator, I think we should do some extra tuning through new
zramtune
service.This service performs:
vm.swappiness
value to 150. We need to push anonymous pages out more, once they are located in ZRAM.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.