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

tmpfiles.d: Add thp-shrinker config to reduce memory usage #108

Merged
merged 1 commit into from
Oct 27, 2024

Conversation

ptr1337
Copy link
Member

@ptr1337 ptr1337 commented Oct 27, 2024

Using the always mode (which is default in Archlinux and CachyOS) provides a quite big performance improvement compared to madvise, but this comes with an increased memory usage.

Recently META has contributed the THP Shrinker, which allows to split pages which are underutilized. This can reduce the used memory usage, while providing mostly the same performance improvement.

409 is the provide value by META and we might want to search for more suited values on the desktop. Also, we should do some benchmarks (cachyos-benchmarker) to see if there is a massive difference between 509 and 411.

https://lore.kernel.org/lkml/[email protected]/

@1Naim
Copy link
Member

1Naim commented Oct 27, 2024

Why can't we just merge this with /usr/lib/tmpfiles.d/thp.conf, i.e. all in one file. Both are related to Transparent Hugepages and it's not like each file has a lot of content like our sysctl file, so IMO putting this to one file is better.

Also, we should do some benchmarks (cachyos-benchmarker)

I wonder if this benchmark will show the differences. I guess we need to do a comparison of madvise vs max_ptes_none=409 vs thp=always default.

@1Naim
Copy link
Member

1Naim commented Oct 27, 2024

kernel_version_comparison_All
Here's some benchmarks with cachyos-benchmarker. As it turns out, it seems to be quite unreliable at comparing the differences between max_ptes_none values (you can only start to see some regressions with absurd values like 50% of zero filled pages).

I think a better benchmark for this would be to build a full-LTO kernel, while also checking for memory usage cc @ptr1337 maybe

https://flightlesssomething.ambrosia.one/benchmark/651 Here's a gaming benchmark I did with stress-ng in the background as well with some virtual memory flags but there's no difference here either.

@ptr1337
Copy link
Member Author

ptr1337 commented Oct 27, 2024

I will merge this for now. It seems not to increase regressions or equal. We can reevaluate the value in the future.

I want to keep it in an own config, so the different functions are split each

@ptr1337 ptr1337 merged commit e3d1c83 into master Oct 27, 2024
@ptr1337 ptr1337 deleted the thp-shrinker branch October 27, 2024 20:00
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