Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
365e062
fs: add *timeNs properties to BigInt Stats objects
joyeecheung Jun 18, 2018
e6353bd
fs: document the Date conversion in Stats objects
joyeecheung Jun 14, 2019
6ff803d
fs: fix (temporary) for esm package
ronag Aug 4, 2019
a7c8322
esm: support loading data URLs
bmeck Jul 9, 2019
293c9f0
bootstrap: run preload prior to frozen-intrinsics
bmeck Aug 2, 2019
b36a6e9
stream: do not emit drain if stream ended
ronag Aug 11, 2019
10bae2e
gyp: futurize imput.py to prepare for Python 3
cclauss Aug 15, 2019
4d4583e
src: add large page support for macOS
devnexen Aug 5, 2019
219c195
deps: update npm to 6.10.3
isaacs Aug 6, 2019
e0537e6
crypto: simplify DSA validation in FIPS mode
tniessen Aug 18, 2019
aeafb91
build: add Python 3 tests to Travis CI
cclauss Aug 18, 2019
eceebd3
tools: fix Python 3 issues in gyp/generator/make.py
cclauss Aug 19, 2019
a123a20
tools: fix Python 3 issues in tools/icu/icutrim.py
cclauss Aug 19, 2019
35bca31
buffer: improve equals() performance
mscdex Aug 19, 2019
925141f
tools: fix mixup with bytes.decode() and str.encode()
cclauss Aug 19, 2019
0544075
buffer: correct concat() error message
mscdex Aug 19, 2019
feafc01
build: move tooltest to before jstest target
danbev Aug 19, 2019
12cbb3f
gyp: remove semicolons (Python != JavaScript)
MattIPv4 Aug 20, 2019
8f47ff1
fs: allow passing true to emitClose option
gntem Aug 19, 2019
1f88ca3
test: add `emitClose: true` tests for fs streams
Trott Aug 22, 2019
65de900
doc: add emitClose option for fs streams
Trott Aug 22, 2019
eb2d96f
module: avoid passing unnecessary loop reference
saghul Aug 22, 2019
e939a87
stream: async iterator destroy compat
ronag Aug 17, 2019
b2f169e
doc: indicate that Http2ServerResponse extends Stream
trivikr Aug 21, 2019
1d649e3
doc: indicate that Http2ServerRequest extends Readable
trivikr Aug 21, 2019
6a4f156
doc: add missing extends Http2Session
trivikr Aug 21, 2019
ed2293e
fs: add recursive option to rmdir()
cjihrig Aug 16, 2019
2fafd63
doc: fix nits in esm.md
vsemozhetbyt Aug 21, 2019
dfc0ef5
net: allow reading data into a static buffer
mscdex Jan 10, 2019
ba29be6
doc,tls: add extends for derived classes
trivikr Aug 21, 2019
8599052
doc: add https.Server extends tls.Server
trivikr Aug 21, 2019
8a93b63
doc,http: add extends for derived classes
trivikr Aug 21, 2019
6e585fb
lib: consolidate lazyErrmapGet()
cjihrig Aug 23, 2019
ef76c7d
doc: add dco to github pr template
MylesBorins Nov 1, 2018
db6e4ce
src: expose MaybeInitializeContext to allow existing contexts
MarshallOfSound Jul 4, 2019
a2c7047
doc,errors: add extends to derived classes
trivikr Aug 25, 2019
395245f
doc,fs: add extends for derived classes
trivikr Aug 25, 2019
9a15002
test: use print() function in both Python 2 and 3
cclauss Aug 24, 2019
783c8ee
tools: fix Python 3 issues in inspector_protocol
cclauss Aug 24, 2019
def5c3e
build: test Python 3.6 and 3.7 on Travis CI
cclauss Aug 24, 2019
6a914ed
build: make --without-snapshot imply --without-node-snapshot
joyeecheung Aug 24, 2019
3bc16f9
events: improve once() performance
mscdex Aug 25, 2019
30b80e5
errors: provide defaults for unmapped uv errors
cjihrig Aug 23, 2019
8c6896e
src: allow --interpreted-frames-native-stack in NODE_OPTIONS
mmarchini May 17, 2019
f4f8827
process: improve nextTick performance
mscdex Jan 12, 2019
bd1e8ea
test: fix flaky test-http-server-keepalive-req-gc
Trott Aug 27, 2019
0e1ccca
querystring: improve performance
mscdex Aug 25, 2019
2df8475
tools: update babel-eslint to 10.0.3
cjihrig Aug 26, 2019
3802da7
tools: update ESLint to 6.2.2
cjihrig Aug 26, 2019
83fb133
test: fix test-benchmark-net
Trott Aug 28, 2019
c900762
buffer: consolidate encoding parsing
mscdex Aug 20, 2019
71aaf59
buffer: correct indexOf() error message
mscdex Aug 20, 2019
5abbd51
util: do not throw when inspecting detached ArrayBuffer
addaleax Aug 25, 2019
d6b6a05
build: integrate DragonFlyBSD into gyp build
devnexen Aug 25, 2019
5c3e49d
crypto: don't expose openssl internals
codebytere Aug 26, 2019
bb72217
doc: heading levels should only increment by one
nschonni Aug 27, 2019
43797d9
doc: inconsistent indentation for list items
nschonni Aug 27, 2019
a94afed
doc: add devnexen to collaborators
devnexen Aug 29, 2019
ae810cc
doc,crypto: add extends for derived classes
trivikr Aug 25, 2019
28ffc9f
deps: V8: cherry-pick 597f885
Aug 29, 2019
0ccf90b
test: remove Windows skipping of http keepalive request GC test
Trott Aug 28, 2019
0c4df35
build: hard code doctool in test-doc target
danbev Aug 30, 2019
2efd72f
stream: improve read() performance
mscdex Aug 27, 2019
e5a9a85
http: simplify timeout handling
ronag Aug 19, 2019
6734782
doc: remove multiple consecutive blank lines
nschonni Aug 29, 2019
187d08b
doc: format http2 anchor link and reference
nschonni Aug 29, 2019
3fc29b8
doc: add blanks around code fences
nschonni Aug 29, 2019
5a16449
doc: add extends for derived classes
trivikr Aug 24, 2019
256da1f
build: add full Python 3 tests to Travis CI
cclauss Aug 28, 2019
4a7c4b7
doc: escape elements swallowed as HTML in markdown
nschonni Aug 30, 2019
2666e00
src: inline `SLICE_START_END()` in node_buffer.cc
addaleax Aug 28, 2019
b964bdd
src: turn `GET_OFFSET()` into an inline function
addaleax Aug 28, 2019
f8f3af0
src: do not crash when accessing empty WeakRefs
addaleax Aug 24, 2019
2489682
console: use getStringWidth() for character width calculation
addaleax Aug 24, 2019
3f68be1
tools: fix mksnapshot blob wrong freeing operator
devnexen Aug 31, 2019
7809adf
stream: don't deadlock on aborted stream
ronag Aug 30, 2019
449f1fd
Revert "build: add full Python 3 tests to Travis CI"
bnoordhuis Sep 2, 2019
350975e
tools: use 'from io import StringIO' in ninja.py
cclauss Aug 29, 2019
87b8f02
lib: add ASCII fast path to getStringWidth()
addaleax Aug 25, 2019
dce5649
build,win: find Python in paths with spaces
joaocgreis Aug 20, 2019
bb6e3b5
build,win: accept Python 3 if 2 is not available
joaocgreis Aug 20, 2019
cd70fd2
tools: update ESLint to 6.3.0
cjihrig Aug 30, 2019
3a2e75d
2019-09-04, Version 12.10.0 (Current)
BridgeAR Sep 3, 2019
b143a87
Working on v12.10.1
BridgeAR Sep 4, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
src: add large page support for macOS
Proposal to bring the support for this platform.
We assume the pse36 cpu flag is present for 2MB
large page support present in recent years
in mac line (not to be backported to 10.x anyway).
Recommended better for mac production servers rather
than casual mac books.

PR-URL: #28977
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
devnexen authored and BridgeAR committed Sep 3, 2019
commit 4d4583e0a200057e33f8fef0efb41ad54b9df4be
8 changes: 5 additions & 3 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1035,16 +1035,18 @@ def configure_node(o):
else:
o['variables']['node_use_dtrace'] = 'false'

if options.node_use_large_pages and not flavor in ('linux', 'freebsd'):
if options.node_use_large_pages and not flavor in ('linux', 'freebsd', 'mac'):
raise Exception(
'Large pages are supported only on Linux Systems.')
if options.node_use_large_pages and flavor in ('linux', 'freebsd'):
'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]
Expand Down
2 changes: 1 addition & 1 deletion node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@
}],
],
}],
[ 'node_use_large_pages=="true" and OS in "linux freebsd"', {
[ 'node_use_large_pages=="true" and OS in "linux freebsd mac"', {
'defines': [ 'NODE_ENABLE_LARGE_CODE_PAGES=1' ],
# The current implementation of Large Pages is under Linux.
# Other implementations are possible but not currently supported.
Expand Down
98 changes: 77 additions & 21 deletions src/large_pages/node_large_page.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#if defined(__FreeBSD__)
#include <sys/sysctl.h>
#include <sys/user.h>
#elif defined(__APPLE__)
#include <mach/vm_map.h>
#endif
#include <unistd.h> // readlink

Expand Down Expand Up @@ -212,6 +214,42 @@ static struct text_region FindNodeTextRegion() {
}
start += cursz;
}
#elif defined(__APPLE__)
struct text_region nregion;
nregion.found_text_region = false;
struct vm_region_submap_info_64 map;
mach_msg_type_number_t count = VM_REGION_SUBMAP_INFO_COUNT_64;
vm_address_t addr = 0UL;
vm_size_t size = 0;
natural_t depth = 1;

while (true) {
if (vm_region_recurse_64(mach_task_self(), &addr, &size, &depth,
reinterpret_cast<vm_region_info_64_t>(&map),
&count) != KERN_SUCCESS) {
break;
}

if (map.is_submap) {
depth++;
} else {
char* start = reinterpret_cast<char*>(hugepage_align_up(addr));
char* end = reinterpret_cast<char*>(hugepage_align_down(addr+size));
size_t esize = end - start;

if (end > start && (map.protection & VM_PROT_READ) != 0 &&
(map.protection & VM_PROT_EXECUTE) != 0) {
nregion.found_text_region = true;
nregion.from = start;
nregion.to = end;
nregion.total_hugepages = esize / hps;
break;
}

addr += size;
size = 0;
}
}
#endif
return nregion;
}
Expand Down Expand Up @@ -267,11 +305,15 @@ static bool IsSuperPagesEnabled() {
// 2: This function should not call any function(s) that might be moved.
// a. map a new area and copy the original code there
// b. mmap using the start address with MAP_FIXED so we get exactly
// the same virtual address
// the same virtual address (except on macOS).
// c. madvise with MADV_HUGE_PAGE
// d. If successful copy the code there and unmap the original region
int
#if !defined(__APPLE__)
__attribute__((__section__(".lpstub")))
#else
__attribute__((__section__("__TEXT,__lpstub")))
#endif
__attribute__((__aligned__(hps)))
__attribute__((__noinline__))
MoveTextRegionToLargePages(const text_region& r) {
Expand All @@ -289,6 +331,9 @@ MoveTextRegionToLargePages(const text_region& r) {
PrintSystemError(errno);
return -1;
}
OnScopeLeave munmap_on_return([nmem, size]() {
if (-1 == munmap(nmem, size)) PrintSystemError(errno);
});

memcpy(nmem, r.from, size);

Expand All @@ -302,7 +347,6 @@ MoveTextRegionToLargePages(const text_region& r) {
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1 , 0);
if (tmem == MAP_FAILED) {
PrintSystemError(errno);
munmap(nmem, size);
return -1;
}

Expand All @@ -313,11 +357,6 @@ MoveTextRegionToLargePages(const text_region& r) {
if (ret == -1) {
PrintSystemError(errno);
}
ret = munmap(nmem, size);
if (ret == -1) {
PrintSystemError(errno);
}

return -1;
}
#elif defined(__FreeBSD__)
Expand All @@ -327,32 +366,46 @@ MoveTextRegionToLargePages(const text_region& r) {
MAP_ALIGNED_SUPER, -1 , 0);
if (tmem == MAP_FAILED) {
PrintSystemError(errno);
munmap(nmem, size);
return -1;
}
#endif

memcpy(start, nmem, size);
ret = mprotect(start, size, PROT_READ | PROT_EXEC);
#elif defined(__APPLE__)
// There is not enough room to reserve the mapping close
// to the region address so we content to give a hint
// without forcing the new address being closed to.
// We explicitally gives all permission since we plan
// to write into it.
tmem = mmap(start, size,
PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_PRIVATE | MAP_ANONYMOUS,
VM_FLAGS_SUPERPAGE_SIZE_2MB, 0);
if (tmem == MAP_FAILED) {
PrintSystemError(errno);
return -1;
}
memcpy(tmem, nmem, size);
ret = mprotect(start, size, PROT_READ | PROT_WRITE | PROT_EXEC);
if (ret == -1) {
PrintSystemError(errno);
ret = munmap(tmem, size);
if (ret == -1) {
PrintSystemError(errno);
}
ret = munmap(nmem, size);
if (ret == -1) {
PrintSystemError(errno);
}
return -1;
}
memcpy(start, tmem, size);
#else
memcpy(start, nmem, size);
#endif

// Release the old/temporary mapped region
ret = munmap(nmem, size);
ret = mprotect(start, size, PROT_READ | PROT_EXEC);
if (ret == -1) {
PrintSystemError(errno);
ret = munmap(tmem, size);
if (ret == -1) {
PrintSystemError(errno);
}
return -1;
}

return ret;
}

Expand All @@ -369,16 +422,19 @@ int MapStaticCodeToLargePages() {
return MoveTextRegionToLargePages(r);

return -1;
#elif defined(__FreeBSD__)
#elif defined(__FreeBSD__) || defined(__APPLE__)
return MoveTextRegionToLargePages(r);
#endif
}

bool IsLargePagesEnabled() {
#if defined(__linux__)
return IsTransparentHugePagesEnabled();
#else
#elif defined(__FreeBSD__)
return IsSuperPagesEnabled();
#elif defined(__APPLE__)
// pse-36 flag is present in recent mac x64 products.
return true;
#endif
}

Expand Down