[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:48:28 PST 2022


treapster added a comment.



> How do you define what makes sense?

Well, something makes sense when benefits outweigh costs. The benefits of aligning after PHDR are not clear because PHDR occupies a small fraction of a page, especially in the context of huge pages, so it's unlikely to significantly increase TLB misses or otherwise affect performance. However, a benchmark would be interesting. While the costs are 2MB in padding space + in case of AArch64, more stubs inserted during longJmp. Processing clang without any flags renders 347691 stubs, with -no-huge-pages - 327125, and difference in .text size is 176 kb. Not that much, but it think it's reasonable to keep sections together unless there is a performance penalty. And i guess those 20k additional stubs also have some performance implications.

>> With use-old-text it's not so clear, so we can align in that case if you feel like it, but at least we shouldn't align after PHDR.
>
> Why? Because PHDR is "small"?

Yes + the above

>> And also it doesn't make sense to align to 2 MB in absence of hugify(because we won't get huge pages anyway), so i think we should act as if -no-huge-pages is true by default. What do you think?
>
> I agree that it doesn't make sense to align at 2MB in the absence of hugify *and* --hot-text.

I'll update the patch to set pageAlign to regular page size unless there's hugify or hot-text.


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