build: adjust ThinLTO's memory usage for non-Android

In the linked bug, we discovered that clean Chrome links with ThinLTO
enabled consume quite a bit of memory. In my measurements, Chrome OS x64
links take around 49GB, and a standard Linux ThinLTO link takes around
46GB.

Build command:
  $ /usr/bin/time -v ninja chrome
  [snip]
  Maximum resident set size (kbytes): 46337504
  [snip]
  $ cat args.gn
  target_os = "linux"
  target_cpu = "x64"
  use_goma = true
  is_official_build = true
  is_chrome_branded = true
  clang_use_default_sample_profile = true
  use_thin_lto = true

(the last two args should be redundant in this case)

Measured similarly, Android's build takes 8-9GB on ARM, so it gets to
stay at 10GB.

Bug: 988364
Change-Id: Ia1bbf6b441dcb9219a37842060e72eebe7ec687e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1755189
Reviewed-by: Peter Collingbourne <pcc@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: George Burgess <gbiv@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#689090}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 0e9a0b02176c9b338132c7e29414448285e72f77
This commit is contained in:
George Burgess IV 2019-08-21 18:24:58 +00:00 коммит произвёл Commit Bot
Родитель edd27ed460
Коммит 9c287be022
1 изменённых файлов: 9 добавлений и 4 удалений

Просмотреть файл

@ -21,10 +21,15 @@ declare_args() {
if (concurrent_links == -1) {
if (use_thin_lto) {
_args = [
"--mem_per_link_gb=10",
"--reserve_mem_gb=10",
]
_args = [ "--reserve_mem_gb=10" ]
# On Chrome OS and Linux, ThinLTO peaks at a bit above 45GB for Chrome.
# Android links weigh in much smaller, at around 8-10GB of working memory
# (measured by /usr/bin/time -v).
if (is_android) {
_args += [ "--mem_per_link_gb=10" ]
} else {
_args += [ "--mem_per_link_gb=45" ]
}
} else if (use_sanitizer_coverage || use_fuzzing_engine) {
# Sanitizer coverage instrumentation increases linker memory consumption
# significantly.