Don't limit ninja -j on Linux beyond ulimit -n

macOS limits the ninja j value to 1000, because ninja has a limit to the
number of open file descriptors of FD_SETSIZE, which is 1024 on Darwin.
On Linux, the ninja binary distributed on Chromium seems to be compiled
with poll.h support, so that this limitation doesn't exist:
22b778ca19/src/subprocess-posix.cc (L59)

Change-Id: I97848bb99c08fe118dbdaea525da713382373c9d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4866223
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
changes/23/4866223/5
Henrique Ferreiro 2 years ago committed by LUCI CQ
parent ce71f37dce
commit 7eb4e4841f

@ -273,12 +273,14 @@ def main(args):
j_value = min(j_value, core_limit)
# On Windows, a -j higher than 1000 doesn't improve build times.
# On POSIX, ninja is limited to at most FD_SETSIZE (1024) open file
# On macOS, ninja is limited to at most FD_SETSIZE (1024) open file
# descriptors.
j_value = min(j_value, 1000)
if sys.platform in ['darwin', 'win32']:
j_value = min(j_value, 1000)
# Use a j value that reliably works with the open file descriptors
# limit.
if sys.platform in ['darwin', 'linux']:
# Use a j value that reliably works with the open file
# descriptors limit.
j_value = min(j_value, int(fileno_limit * 0.8))
args.append('%d' % j_value)

Loading…
Cancel
Save