[Feature Request] Add and enable uksmd
ksm is a feature of the linux kernel to deduplicate ram. uksmd is that, but made hyper aggressive. I've found it extremely useful for desktop use.
Most recently updated repo (seems to come with some bugfixes)
Cachyos repo comes with a monitoring script.
Why I think uksmd should be added:
- Ram savings are significant. I usually find around half a gigabyte saved (10-15 firefox tabs), or up to 1.5 gigs of ram saved on heavy usage (25+). On a low ram (4 GB or less) environment, web browsers become much more usable. On high ram systems, it's basically free ram.
Why I think uksmd should not be added:
- Ram deduplication creates risk of vulnerabilities. For example, the known row hammer hammer attack. In addition to that, most found and patched vulnerabilities relating to ram deduplication are related to use of ksm/other tools for virtual machines and containers. Deduplicating the ram contents of desktop software, like browser tabs, is a somewhat new usecase, which definitely comes with it's own security risks. Ram deduplication potentially provides a new avenue for browser exploits, like container escaping.
- In order to hash new pages, uksmd must use cpu power. Although generally, uksmd will always save more ram than cpu it spends, if you are playing a cpu bound game, and there isn't really anything for uksmd to dedupe, there will be a tiny performance hit. However, considering you have decided to use zram (as opposed to not using zswap/zram), which has a similar cpu performance hit, I don't think there will be a problem with uksmd.
Other concerns:
- If the nobara kernel does not come with the pmadv_ksm() syscall, you may not want to add it for whatever reason. I think it does though, as most of the desktop optimized kernels I have tried do.
- uksmd takes time to "ramp up," before the ram savings really start kicking in. This means a slight performance hit while uksmd hashes pages.
Anyway, I've tried to be as blunt as possible. I really hope you chose to implement this, because it would make Nobara linux much more usable on low ram systems, because uksmd + zram are really powerful when it comes to enabling users to best utilize limited ram. However, almost no other distro comes with zram by default, rather than zswap, which slows when it begins to swap from disk (and cannot deduplicate pages if I read the documentation correctly.)