-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v10.x] Backport large pages to v10.x #31105
[v10.x] Backport large pages to v10.x #31105
Conversation
Sources of conflicts:
Other differences
|
4fce04e
to
0c80d6a
Compare
0c80d6a
to
d47b068
Compare
b71affe
to
d31ecce
Compare
d31ecce
to
38a7862
Compare
#ifndef MAP_ANONYMOUS | ||
#define MAP_ANONYMOUS MAP_ANON | ||
#endif | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a v10.x-only change
node.gypi
Outdated
[ 'OS=="linux" and target_arch=="x64" and node_use_large_pages=="true"', { | ||
[ 'OS=="linux" and ' | ||
'target_arch=="x64" and ' | ||
'llvm_version==0', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the spot below is where I replaced "0.0"
with 0
node.gypi
Outdated
}], | ||
[ 'OS=="linux" and ' | ||
'target_arch=="x64" and ' | ||
'llvm_version!=0', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... the spot below ...
During the addition of macOS support for large pages, a `memcpy` ended up under the wrong preprocessor directive. As a result, the newly allocated large pages were not initialized with a copy of the text section. Thanks to Suresh Srinivas <suresh.srinivas@intel.com>! PR-URL: nodejs#29914 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
Multiple sections may be marked as "r-xp" and with the executable's path. We use the location of the `__nodetext` symbol added by the linker script to ensure that the range we retrieve from the maps file does indeed contain the Node.js text section. Thanks to Suresh Srinivas <suresh.srinivas@intel.com>! PR-URL: nodejs#29973 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
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. PR-URL: nodejs#30954 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Co-authored-by: David Carlier <devnexen@gmail.com>
350784c
to
9b83046
Compare
@bnoordhuis @devnexen @lundibundi @richardlau I backported all the changes and fixes that have happened on master in the interim. That's effectively a re-backport. Please take another look! |
Re-introduce the build-time option as a no-op in order to retain backward compatibility for LTS purposes. Re: nodejs#31063 (review) PR_URL: nodejs#31075 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
PR-URL: nodejs#31095 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
The usage of the relevant methods from the file is conditional so make the include conditional too. PR-URL: nodejs#31078 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Emit a warning when the user configures with `--use-largepages` and/or `--use-largepages-script-lld` informing them that the option is now available as a Node.js runtime option once it is built. Refs: nodejs#31063 (comment) PR-URL: nodejs#31103 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com>
PR-URL: nodejs#31196 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Declaring and initializing a `struct text_region` is common to all three implementations of the large pages mapping code. Let's make it unconditional. PR-URL: nodejs#31385 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: JungMinu - Minwoo Jung <jmwsoft@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Gus Caplan <me@gus.host>
`__executable_start` is provided by GNU's and LLVM's default linker scripts, obviating the need to plug in a custom linker script. The problem with our bespoke linker script is that it works with ld.bfd but not ld.gold and cannot easily be ported because the latter linker doesn't understand the `INSERT BEFORE` directive. The /proc/self/maps scanner is updated to account for the fact that there are a number of sections between `&__executable_start` and the start of the .text section. Fortunately, those sections are all mapped into the same memory segment so we only need to look at the next line to find the start of our text segment. Fixes: nodejs#31520 PR-URL: nodejs#31547 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
Restrict the usage of the C preprocessor directive enabling large pages support to the large pages implementation. This cleans up the code in src/node.cc. PR-URL: nodejs#31904 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com>
We create an object file in assembly which introduces the symbol `__node_text_start` into the .text section and place the resulting object file as the first file the linker encounters. We do this to ensure that we can recognize the boundaries of the .text section when attempting to establish the address range to map to large pages. Additionally, we rename the section containing the remapping code from `.lpstub` to `lpstub` so as to take advantage of the linker's feature whereby it inserts the symbol `__start_lpstub` when the section's name can be rendered as a valid C variable. We need this symbol in order to avoid self-mapping the remapping code to large pages, because doing so would cause the process to crash. PR-URL: nodejs#31981 Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
The ninja build places objects in a different directory. Co-authored-by: Gabriel Schulhof <gabriel.schulhof@intel.com> Signed-off-by: Richard Lau <riclau@uk.ibm.com> PR-URL: nodejs#32071 Reviewed-By: Matheus Marchini <mat@mmarchini.me> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
9b83046
to
c71d059
Compare
@gabrielschulhof given the number of regressions that were introduced by this change and the subsequent fixes I have to be honest that I am reluctant to see this land in 10.x just before it goes into maintenance. Can you share a bit more about the importance of this feature and why we should prioritize for 10.x? To be clear, not trying to bring stop energy, just want to have a full picture if I'm going to make any sort of recommendation |
@MylesBorins that's fair. Having the feature in v13.x and, hopefully, with #32092 landed, in v12.x should give it enough exposure, as well as shakedown time. |
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesI'm getting an error locally which I'm hoping won't happen on the CI