[PATCH] D137620: [BOLT] Don't align .text to pageAlign

Denis Revunov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 21 02:26:14 PST 2022


treapster added a comment.

In D137620#4009042 <https://reviews.llvm.org/D137620#4009042>, @maksfb wrote:

> Thank you for the investigation on THPs and hugify. Indeed, it didn't work for me either. Putting `munlock(2)` before `madvise(2)` helps though. Could you please check D140425 <https://reviews.llvm.org/D140425> on your end?

I applied the patch, and BOLTing helloworld, launching it from GDB and running `cat /proc/PID/smaps | grep Huge` or `grep FilePmdMapped` still doesn't show any non-zero values. I tried with /sys/kernel/mm/transparent_hugepage/enabled set to always and to madvise. I also tried processing redis-server, llaunching it and looking at it's mappings, and in that case i was able to find 6MB of HugePages, but it was mapped somewhere at 7ffff7400000-7ffff7c00000 which is definetely not .text section and looks like some internal anonymous mapping, and i am able to find it even if processing without the patch. If, however, i modify `__bolt_hugify_self_impl` to always call `hugifyForOldKernel`, i'm able to see HugePages for .text mapping both in helloworld and redis. All of the above was done on 5.10.0-1013-oem. But i also found that in kernel sources i linked above i missed a call to file_thp_enabled <https://elixir.bootlin.com/linux/v5.19.17/source/mm/khugepaged.c#L466> before check for anonymity. For this call to succeed, READ_ONLY_THP_FOR_FS config option must be enabled, and in our setup it is not set, so it's likely the cause of the issue. Can you check if it's enabled on your system?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137620/new/

https://reviews.llvm.org/D137620



More information about the llvm-commits mailing list