This is an archive of the discontinued LLVM Phabricator instance.

[BOLT][HUGIFY] Adds fix for -hugify option
Needs ReviewPublic

Authored by yavtuk on Jan 12 2023, 11:30 PM.

Details

Summary

This patch adds the checking THP support based on kernel version and kernel configuration.

Diff Detail

Event Timeline

yavtuk created this revision.Jan 12 2023, 11:30 PM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: ayermolo. · View Herald Transcript
yavtuk requested review of this revision.Jan 12 2023, 11:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 12 2023, 11:30 PM
yavtuk updated this revision to Diff 488875.Jan 12 2023, 11:33 PM

included context

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.

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?

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.

yavtuk updated this revision to Diff 490388.EditedJan 19 2023, 12:32 AM
yavtuk edited the summary of this revision. (Show Details)

@maksfb how about such kind of checking?

@maksfb how about such kind of checking?

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.