From a83c5df8dfc2646a13c78e787bedd72012accb59 Mon Sep 17 00:00:00 2001 From: Gabriel Schulhof Date: Fri, 13 Dec 2019 11:59:37 -0800 Subject: [PATCH 01/10] src: make --use-largepages a runtime option Moves the option that instructs Node.js to-remap its static code to large pages from a configure-time option to a runtime option. This should make it easy to assess the performance impact of such a change without having to custom-build. --- configure.py | 33 ----------------------- doc/api/cli.md | 10 +++++++ doc/node.1 | 5 ++++ node.gyp | 2 +- node.gypi | 6 ++--- src/large_pages/node_large_page.cc | 6 ++--- src/node.cc | 18 ++++++------- src/node_options.cc | 4 +++ src/node_options.h | 1 + test/parallel/test-startup-large-pages.js | 19 +++++++++++++ 10 files changed, 53 insertions(+), 51 deletions(-) create mode 100644 test/parallel/test-startup-large-pages.js diff --git a/configure.py b/configure.py index 95766d405a3f0a..de27bb340385e6 100755 --- a/configure.py +++ b/configure.py @@ -404,17 +404,6 @@ dest='with_etw', help='build with ETW (default is true on Windows)') -parser.add_option('--use-largepages', - action='store_true', - dest='node_use_large_pages', - help='build with Large Pages support. This feature is supported only on Linux kernel' + - '>= 2.6.38 with Transparent Huge pages enabled and FreeBSD') - -parser.add_option('--use-largepages-script-lld', - action='store_true', - dest='node_use_large_pages_script_lld', - help='link against the LLVM ld linker script. Implies -fuse-ld=lld in the linker flags') - intl_optgroup.add_option('--with-intl', action='store', dest='with_intl', @@ -1068,28 +1057,6 @@ def configure_node(o): else: o['variables']['node_use_dtrace'] = 'false' - if options.node_use_large_pages and not flavor in ('linux', 'freebsd', 'mac'): - raise Exception( - 'Large pages are supported only on Linux, FreeBSD and MacOS Systems.') - if options.node_use_large_pages and flavor in ('linux', 'freebsd', 'mac'): - if options.shared or options.enable_static: - raise Exception( - 'Large pages are supported only while creating node executable.') - if target_arch!="x64": - raise Exception( - 'Large pages are supported only x64 platform.') - if flavor == 'mac': - info('macOS server with 32GB or more is recommended') - if flavor == 'linux': - # Example full version string: 2.6.32-696.28.1.el6.x86_64 - FULL_KERNEL_VERSION=os.uname()[2] - KERNEL_VERSION=FULL_KERNEL_VERSION.split('-')[0] - if KERNEL_VERSION < "2.6.38" and flavor == 'linux': - raise Exception( - 'Large pages need Linux kernel version >= 2.6.38') - o['variables']['node_use_large_pages'] = b(options.node_use_large_pages) - o['variables']['node_use_large_pages_script_lld'] = b(options.node_use_large_pages_script_lld) - if options.no_ifaddrs: o['defines'] += ['SUNOS_NO_IFADDRS'] diff --git a/doc/api/cli.md b/doc/api/cli.md index 171f6b8ad29780..4c549e3375760f 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -863,6 +863,15 @@ environment variables. See `SSL_CERT_DIR` and `SSL_CERT_FILE`. +### `--use-largepages` + + +Re-map the Node.js static code to large memory pages at startup. If supported on +the target system, this will cause the Node.js static code to be moved onto 2 +MiB pages instead of 4 KiB pages. + ### `--v8-options` @@ -872,6 +872,13 @@ Re-map the Node.js static code to large memory pages at startup. If supported on the target system, this will cause the Node.js static code to be moved onto 2 MiB pages instead of 4 KiB pages. +The following values are valid for `num`: +* 0: No mapping will be attempted. This is the default. +* 1: If supported by the OS, mapping will be attempted. Failure to map will be + ignored and will not be reported. +* 2: If supported by the OS, mapping will be attempted. Failure to map will be + ignored and a message will be printed to standard error. + ### `--v8-options` @@ -872,12 +872,12 @@ Re-map the Node.js static code to large memory pages at startup. If supported on the target system, this will cause the Node.js static code to be moved onto 2 MiB pages instead of 4 KiB pages. -The following values are valid for `num`: -* 0: No mapping will be attempted. This is the default. -* 1: If supported by the OS, mapping will be attempted. Failure to map will be - ignored and will not be reported. -* 2: If supported by the OS, mapping will be attempted. Failure to map will be - ignored and a message will be printed to standard error. +The following values are valid for `mode`: +* `off`: No mapping will be attempted. This is the default. +* `silent`: If supported by the OS, mapping will be attempted. Failure to map + will be ignored and will not be reported. +* `verbose`: If supported by the OS, mapping will be attempted. Failure to map + will be ignored and a message will be printed to standard error. ### `--v8-options`