This patch adds the checking THP support based on kernel version and kernel configuration.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Could you clarify why this is a "temporary solution"? Are you working on a different patch? THP support might still be useful, but only under an option.
@maksfb I think the full solution is to check READ_ONLY_THP_FOR_FS option in /boot/config-xxx file.
Depends on the option state and kernel version we can call munlock & madvise or hugifyForOldKernel function.
I wouldn’t want to add extra options, if you agree with this implementation I can prepare the patch, what do you think?
Currently, I don’t see a guaranteed way to acquire THPs. As much as I hate adding a new option, I don’t see a way around it. I considered checking for envvar during runtime, but that solution has its own drawbacks. Although it’s a viable alternative.
The config file on my system has a different name. Even if we get the file name correctly, it still wouldn't guarantee THP availability for the process. E.g., at the moment I have CONFIG_READ_ONLY_THP_FOR_FS set, but I cannot get huge pages from the system.