Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Source: https://www.reddit.com/r/linux_gaming/comments/vla9gd/comment/ie1cnrh/
- I'd recommend setting watermark_scale_factor to 125. That was my sweet spot value for gaming. A too high value will permit the kernel swap daemon kswapd to keep asyncrounously evict memory pages until a specific amount of free memory is left for your active working set. In other words, it makes it much more aggressive and it does use more system time. You don't want that while gaming, but you also don't want a too low value. Anything between 125-200 is good, I think the Zen kernel actually makes it 200.
- Also, the reason why I asked about THP is because while it does improve gaming performance (for me, it's not just FPS but also frame time stability) is because it can be a bit unstable when it comes to swapping. Because most of your active working set is anonymous memory mappings (if you check /proc/meminfo it's often 5 or 6:1 relative to file mappings, it can go higher if you have a game running), and those are the ones having huge pages, since you do have swap enabled, what will happen is that the hugepages will literally not be reduced to normal size during swapping. This conflicts with ZRAM/zswap, because it means more CPU time will be needed to compress the page when it's swapped, which ruins your game process.
- As for swappiness, it's fine to have it set to 100 when you're just browsing or doing normal stuff, however, unless you run other programs while gaming, I'd suggest reducing it down to 10-40. The reason being is that you will see some sources online telling you that the value is out of percentage memory, which is not true. The value simply represents the kernel's tendency to swap out anonymous memory pages relative to other pages, such as file ones. Since we've established that most of your working set, ( memory needed for running applications) is comprised of anonymous memory pages, it's counterproductive for gaming performance to tell the kernel to prioritize swapping those out in favor of keeping your file pages untouched. Not to mention that you use THP, which means that in order to maximize gaming performance, there needs to be an abundance of hugepages which will reduce TLP misses and therefore boost the performance of your game. So you don't want those to be swapped out as they will hurt the performance of your games as said before. Because of this, it's best to actually reduce the swappiness, even while using ZRAM/zswap.
- I understand it may not be very temping to use a different kernel, but Zen I think uses MG-LRU and it enables it by default. If this isn't somehow working well for you in terms of lowering swap overhead, then what I'd suggest is to install a custom kernel from AUR that comes with the le9 patchset and set the vm.anon_min_kbytes value to roughly 25-50% of your physical RAM. This is in particular has allowed me to prevent swapping from ruining my gaming performance even on low RAM.
- As for vm.dirty_ratio and vm.dirty_background_ratio, I doubt this is the underlying source of your bottlneck. This more often than not affects people who do things like write to flash drives and do disk-intensive stuff that involves a lot of writes, and not reads. I'd suggest you install atop, it's a really good system monitor tool that can help you identify a specific bottleneck when your system's performance degrades. It will show you how much dirty memory is being used, and if it's not much I don't really recommend changing the vm dirty values from the default because it doesn't affect gaming as much as it affects other things.
- Finally, if you're having an issue with disk I/O you can try to limit the number of read and write requests by changing nr_requests. echo '(try a value between 8-16)' | sudo tee /sys/block/sda/queue/nr_requests
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement