[PATCH] D69294: [LLD][ELF] Support -[no-]mmap-output-file

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 22 11:24:59 PDT 2019


MaskRay added a comment.

I don't know btrfs well but my current understanding is that there is a trade-off between compression rates and performance.

`--no-mmap-output-file` is supported though currently ignored, so filling in its functionality seems fine.  I've got some suggestions and questions about the description.

> Add support for -[no-]mmap-output-file to ELF. LLD currently explicitly ignores this flag for compatibility with the GNU linker.

GNU linker*s*, or more explicitly, GNU ld and gold.

> However, when BtrFS compression is enabled, BtrFS writes 128KB blocks. Since LLD doesn't write the output file sequentially, this causes massive write and compression amplification.

Do the flushes of random accessed dirty pages make it slow under memory pressure?

> FileOutputBuffer::F_in_memory

FileOutputBuffer does no have this mode. Do you have another patch that has not been sent?

> -compress-force=zstd

What is compression is turned off? Have you measured the performance differences with and without --no-mmap-output-file? I think I have asked too much, but if you have access to some ext4/XFS/ZFS machines, the numbers will be useful... CentOS has defaulted to XFS and ext4 is the most widely used fs on Linux.



================
Comment at: lld/test/ELF/mmap-output-file.s:4
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+# RUN: ld.lld %t.o -mmap-output-file -o %t1
+# RUN: llvm-objdump -d %t1 | FileCheck %s
----------------
Just check the output is the same.

```
llvm-mc -filetype=obj -triple=x86-unknown-linux /dev/null -o %t.o
ld.lld %t.o -o %t
ld.lld --no-mmap-output-file %t.o -o %t1
cmp %t %t1
ld.lld --mmap-output-file %t.o -o %t2
cmp %t %t2
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69294





More information about the llvm-commits mailing list