diff --git a/tools/v8_gypfiles/features.gypi b/tools/v8_gypfiles/features.gypi index 7e71e9c46790ab..3a7f355ef8021b 100644 --- a/tools/v8_gypfiles/features.gypi +++ b/tools/v8_gypfiles/features.gypi @@ -72,7 +72,21 @@ 'v8_enable_etw_stack_walking': 1, }, { 'v8_enable_etw_stack_walking': 0, - }] + }], + ['OS=="linux"', { + # Sets -dV8_ENABLE_PRIVATE_MAPPING_FORK_OPTIMIZATION. + # + # This flag speeds up the performance of fork/execve on Linux systems for + # embedders which use it (like Node.js). It works by marking the pages that + # V8 allocates as MADV_DONTFORK. Without MADV_DONTFORK, the Linux kernel + # spends a long time manipulating page mappings on fork and exec which the + # child process doesn't generally need to access. + # + # See v8:7381 for more details. + 'v8_enable_private_mapping_fork_optimization': 1, + }, { + 'v8_enable_private_mapping_fork_optimization': 0, + }], ], 'is_debug%': 0, @@ -320,6 +334,9 @@ ['v8_enable_hugepage==1', { 'defines': ['ENABLE_HUGEPAGE',], }], + ['v8_enable_private_mapping_fork_optimization==1', { + 'defines': ['V8_ENABLE_PRIVATE_MAPPING_FORK_OPTIMIZATION'], + }], ['v8_enable_vtunejit==1', { 'defines': ['ENABLE_VTUNE_JIT_INTERFACE',], }],