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

Denis Revunov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 7 01:46:12 PST 2022


treapster added a comment.

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

>> It also means that current implementation of -hugify is useless on newer kernels because if addresses are properly aligned, it does not create anonymous mapping and calls madvise right away, which does not return huge page(it can be checked by cat /proc/PID/smaps | grep HugePage, there will be all zeroes).
>
> Are you sure? They might be marked differently in `/proc/pid/smaps`, e.g. `FilePmdMapped`.

Grepping for FilePmdMapped also doesn't show any non-zero values, so i'm pretty sure. And the doc for HugePages and Madvise says clearly that HugePages only work for anonymous mappings:
>From here <https://man7.org/linux/man-pages/man2/madvise.2.html>:

> Currently, Transparent Huge Pages work only with private anonymous pages (see mmap(2) <https://man7.org/linux/man-pages/man2/mmap.2.html>).

>From here <https://docs.kernel.org/admin-guide/mm/transhuge.html>:

> Currently THP only works for anonymous memory mappings and tmpfs/shmem. But in the future it can expand to other filesystems.

And here is what happens in the kernel:
call to khugepaged_enter_vma <https://elixir.bootlin.com/linux/v5.19.17/source/mm/khugepaged.c#L368>
call to hugepage_vma_check <https://elixir.bootlin.com/linux/v5.19.17/source/mm/khugepaged.c#L515>
abort if not anonymous <https://elixir.bootlin.com/linux/v5.19.17/source/mm/khugepaged.c#L469>


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