From f1fef462c0f7d9df50b9bb96d9a8cd2095d411de Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Fri, 11 Jul 2025 09:52:43 +0200 Subject: [PATCH] build: reenable v8_enable_temporal_support (#47715) * build: reenable v8_enable_temporal_support Co-authored-by: deepak1556 * ci: test with increased vm map count Co-authored-by: deepak1556 * chore: backport PA use fewer vmas by default on linux Co-authored-by: deepak1556 * chore: update patches Co-authored-by: patchup[bot] <73610968+patchup[bot]@users.noreply.github.com> * Revert "ci: test with increased vm map count" This reverts commit b626c9a5ab7ad3f01e17d77c330abfd8096a8b02. Co-authored-by: deepak1556 * ci: remove logs Co-authored-by: deepak1556 --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: deepak1556 Co-authored-by: patchup[bot] <73610968+patchup[bot]@users.noreply.github.com> --- build/args/all.gn | 3 - patches/chromium/.patches | 1 + ...wer_vmas_by_default_on_linux_systems.patch | 59 +++++++++++++++++++ 3 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 patches/chromium/partitionalloc_use_fewer_vmas_by_default_on_linux_systems.patch diff --git a/build/args/all.gn b/build/args/all.gn index d8919276674d..65660870dbcf 100644 --- a/build/args/all.gn +++ b/build/args/all.gn @@ -10,9 +10,6 @@ v8_embedder_string = "-electron.0" # TODO: this breaks mksnapshot v8_enable_snapshot_native_code_counters = false -# TODO: remove once https://issues.chromium.org/issues/416540976 is resolved -v8_enable_temporal_support = false - # we use this api v8_enable_javascript_promise_hooks = true diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 5676c718ed49..fe6fcda5c2de 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -136,3 +136,4 @@ revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch build_partial_revert_mac_fullscreen_top_chrome_mouse_events.patch revert_update_siso-chromium_image.patch build_set_mac_sdk_minimum_to_10.patch +partitionalloc_use_fewer_vmas_by_default_on_linux_systems.patch diff --git a/patches/chromium/partitionalloc_use_fewer_vmas_by_default_on_linux_systems.patch b/patches/chromium/partitionalloc_use_fewer_vmas_by_default_on_linux_systems.patch new file mode 100644 index 000000000000..db5473b95e29 --- /dev/null +++ b/patches/chromium/partitionalloc_use_fewer_vmas_by_default_on_linux_systems.patch @@ -0,0 +1,59 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Beno=C3=AEt=20Liz=C3=A9?= +Date: Wed, 9 Jul 2025 05:33:09 -0700 +Subject: Use fewer VMAs by default on Linux systems + +Some clients of PartitionAlloc (for instance mksnapshot, part of +Chromium's build through V8, which uses PartitionAlloc but not with +Chromium's config) do not use Chromium's partition_alloc_support.cc to +configure it. As a result, they still get the default behavior which is +creatig a lot of memory regions. + +This is shows to cause crashes in certain build configs on some Linux +systems for mksnapshot. Make the new behavior default for clients that +do not use the feature. This is temporary, the feature flag will be +removed once we settle on what to do on all platforms. + +With this patch, mksnapshot succeeds with a limit of 8k VMAs (but not +the full Chromium build, as linking requires more). Tested by running: + +$, sudo sh -c 'echo 8000 > /proc/sys/vm/max_map_count + +$ ./mksnapshot --turbo_instruction_scheduling --stress-turbo-late-spilling +--target_os=linux --target_arch=x64 --embedded_src gen/v8/embedded.S +--predictable --no-use-ic --builtins-effects-src +gen/v8/src/builtins/builtins-effects.cc --turbo-elide-frames --embedded_variant +Default --random-seed 314159265 --startup_blob snapshot_blob.bin +--native-code-counters --concurrent-builtin-generation +--concurrent-turbofan-max-threads=0 --verify-heap + +Bug: 416540976 +Change-Id: I38639512d6b697b5d06747646d642fa2ead57dbc +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6718547 +Reviewed-by: Kentaro Hara +Commit-Queue: Benoit Lize +Cr-Commit-Position: refs/heads/main@{#1484268} + +diff --git a/base/allocator/partition_allocator/src/partition_alloc/partition_root.h b/base/allocator/partition_allocator/src/partition_alloc/partition_root.h +index 91bb8bb43ca2ce1be7959a1be9aa2d8d91d7482f..423fa5ac9e36360f3909535afa41371b2588c50d 100644 +--- a/base/allocator/partition_allocator/src/partition_alloc/partition_root.h ++++ b/base/allocator/partition_allocator/src/partition_alloc/partition_root.h +@@ -187,7 +187,17 @@ struct PartitionOptions { + // compression ratio of freed memory inside partially allocated pages (due to + // fragmentation). + EnableToggle eventually_zero_freed_memory = kDisabled; +- EnableToggle fewer_memory_regions = kDisabled; ++ // Linux-based systems have a limited per-process VMA limit, be more ++ // conservative there. This matches the feature setting in ++ // partition_alloc_features.cc, but not all clients use Chromium's feature ++ // system to configure PartitionAlloc. ++ EnableToggle fewer_memory_regions = ++#if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_ANDROID) || \ ++ PA_BUILDFLAG(IS_CHROMEOS) ++ kEnabled; ++#else ++ kDisabled; ++#endif + + struct { + EnableToggle enabled = kDisabled;