[PATCH] D116367: [ELF][LTO] --thinlto-index-only: call madvise(MADV_DONTNEED)

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 29 09:39:17 PST 2021


tejohnson added a comment.

In D116367#3212369 <https://reviews.llvm.org/D116367#3212369>, @MaskRay wrote:

> This can be used by in-process LTO. I haven't tested it yet.

Would it be better to try unconditionally marking all/only the bitcode file memory buffers as MADV_DONTNEED?

For the large thin link this change is very close to the same peak RSS reduction as with my change to destroy the buffer objects completely:
Head: 10.7G
Destroy: 8.9G
Don'tNeed: 9.1G

However, when I tried my earlier version which unconditionally freed all the memory buffers, I found that the memory buffer name is used when creating the output indices, which I fixed by saving the name in the InputFile object. Would not doing so with this change cause a time degradation because we will need to pull all these pages back in to get the name from the buffers?



================
Comment at: lld/ELF/Driver.cpp:2388
   // Also bail out here when only certain thinLTO modules are specified for
   // compilation. The intermediate object file are the expected output.
+  const bool skipLinkedOutput = config->thinLTOIndexOnly || config->emitLLVM ||
----------------
Comment from the second sentence onward should be moved back to the early return, as it relates to that part, or otherwise updated accordingly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116367



More information about the llvm-commits mailing list