Commit 0db62fcf authored by Yoshisato Yanagisawa's avatar Yoshisato Yanagisawa Committed by Commit Bot

autoninja: don't set -l.

autoninja automatically sets -l <num_cores>.  -l option makes ninja
not invoke a new command if current CPU load average is above -l.

However, as far as I investigated, -l <num_cores> make the build
much slower than without -l especially on Linux & OSX machines with
small numbers of cores.  I should say -l decreases the build
performance.  When I build Chromium with Goma with the same -j with
autoninja without -l, the load average goes more than the number of
cores while keeping the machine working as usual.
Also, ninja can invoke commands until the spike of command invocation
is reflected to load average, -l might not mitigate for a machine
to get stuck by too high load.

Note that from what I understand from the implementation, Windows
ninja's posix-compatible load average is always less than num_cores.
i.e. -l <num_cores> won't limit the process invocation.
https://github.com/ninja-build/ninja/blob/59849864592b421e0a8f993011e7e5c2ab27e77b/src/util.cc#L479

Let me make autoninja not set -l and bring better build performance
on machines with small number of cores.

Bug: b/117810340
Change-Id: I50f231f1a8976f8ecfc3a0c778f0f1ac98d3827f
Reviewed-on: https://chromium-review.googlesource.com/c/1290611Reviewed-by: 's avatarAndrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: 's avatarBruce Dawson <brucedawson@chromium.org>
Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
parent 861640f6
......@@ -15,7 +15,7 @@ import os
import re
import sys
# The -t tools are incompatible with -j and -l
# The -t tools are incompatible with -j
t_specified = False
j_specified = False
output_dir = '.'
......@@ -81,12 +81,4 @@ if not j_specified and not t_specified:
args.append('-j')
args.append('%d' % (num_cores + core_addition))
if not t_specified:
# Specify a maximum CPU load so that running builds in two different command
# prompts won't overload the system too much. This is not reliable enough to
# be used to auto-adjust between goma/non-goma loads, but it is a nice
# fallback load balancer.
args.append('-l')
args.append('%d' % num_cores)
print ' '.join(args)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment