[PATCH] D116367: [ELF][LTO] --thinlto-index-only: call madvise(MADV_DONTNEED)
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 29 01:15:19 PST 2021
MaskRay created this revision.
Herald added subscribers: arphaman, arichardson, inglorion, emaste.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
@tejohnson noticed that freeing MemoryBuffer instances right before
`lto->compile` can save RSS.
Symbol and section names are backed by MemoryBuffer, so simply destroying
MemoryBuffer would make some infrequent passes (parseSymbolVersion,
reportBackrefs) crash and make debugging difficult. This patch leverages
madvise(MADV_DONTNEED) which hieve the major gain without the latent issues.
`Maximum resident set size (kbytes): ` for a large --thinlto-index-only link:
- current behavior: 10146104
- destroy MemoryBuffer instances: 8555240
- madvise(MADV_DONTNEED): 8739796
Based on D116366 <https://reviews.llvm.org/D116366>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D116367
Files:
lld/ELF/Driver.cpp
lld/ELF/Driver.h
lld/ELF/InputFiles.cpp
lld/ELF/InputFiles.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116367.396503.patch
Type: text/x-patch
Size: 5367 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211229/185dd3db/attachment.bin>
More information about the llvm-commits
mailing list