Memory needs to be unlocked before madvise(2) is called for transparent
huge pages. I verified that /proc/<pid>/smaps reports FilePmdMapped
correctly. Note that there's a (non-deterministic) delay before the call
to madvise() is issued and pages are remapped. Thus, it's difficult to
test the functionality automatically.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
There's no corresponding kernel patch. The hugify feature was apparently always broken for THP kernels as pointed out by @treapster in D137620.
@maksfb I'm just not completely understand why mlock has something todo with it? Why the binary memory even get locked on startup?
@maksfb Can you use __prctl(41 /* PR_SET_THP_DISABLE */, 0, 0, 0, 0); call instead of munlock?
I've used the code from HHVM's hugify (https://github.com/facebook/hhvm/blob/62d67f83bd96b23f8522fb1d3fe8597bcfd7fc75/hphp/runtime/base/program-functions.cpp#L859-L863), and huge pages started to work for me. I'm not entirely sure why the memory was locked in the first place.
@maksfb I see, thank you. I assume that the application code becomes locked due to some kind of meta optimisations for the services on the kernel level or interpreter , probably it is not common situation... Because of that I don't really think this munlock call may harm somehow, so LGTM.