Conversation
Linux ARM64 kernels can be configured with 4KB, 16KB, or 64KB page sizes. Previously, the default CeilingOnPageSize for Linux ARM64 was 16KB, which caused an immediate RELEASE_ASSERT crash on systems with 64KB pages (e.g., RHEL aarch64, Oracle Linux, Ubuntu generic-64k). The existing USE(64KB_PAGE_BLOCK) workaround disables both JIT and bmalloc/libpas, which is a significant performance regression. This change raises CeilingOnPageSize to 64KB for all Linux ARM64 builds, and correspondingly updates libpas page/granule sizes to be at least 64KB on Linux ARM64. This allows Bun and other WebKit embedders to run on 64KB page kernels with full JIT and libpas support. Changes: - WTF/PageBlock.h: Set CeilingOnPageSize=64KB for Linux ARM64 - libpas/pas_internal_config.h: Raise small page (16KB->64KB), small bitfit page (16KB->64KB), medium page (128KB->256KB), and granule size (16KB->64KB) for Linux ARM64 - libpas/jit_heap_config.h: Raise JIT small page/granule (16KB->64KB) and JIT medium page/granule (128KB->256KB / 16KB->64KB) - libpas/pas_expendable_memory.h: Raise expendable memory page size (16KB->64KB) for Linux ARM64 - bmalloc/BPlatform.h: Add BUSE_PRECOMPUTED_CONSTANTS_VMPAGE64K These changes propagate correctly through: - ConfigSizeToProtect (via std::max(CeilingOnPageSize, 16*KB)) - OpcodeConfigSizeToProtect (same pattern) - MarkedBlock::blockSize (via std::max(16*KB, CeilingOnPageSize)) - All libpas heap configs that use PAS_*_DEFAULT_SIZE constants - mprotect/mmap calls that use runtime pageSize() Co-Authored-By: Claude <noreply@anthropic.com>
The previous hardcoded 2048 assumed PAS_SMALL_PAGE_DEFAULT_SIZE=16KB. With 64KB pages, num_alloc_bits = page_size >> min_align_shift can reach 8192 (utility heap, PAS_INTERNAL_MIN_ALIGN_SHIFT=3), causing pas_baseline_allocator_attach_directory to PAS_ASSERT when a thread hits the baseline allocator slow path.
…anule use-count under uint8_t DECOMMITTED sentinel
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
Disabled knowledge base sources:
WalkthroughUpdated compile-time page-size configurations for Linux ARM64 across WTF and bmalloc subsystems, changing default allocator page sizes from 16 KiB to 64 KiB. Modified PageBlock.h selection logic and added platform-specific constants in multiple configuration headers. Changes
Possibly related PRs
Comment Tip You can validate your CodeRabbit configuration file in your editor.If your editor has YAML language server, you can enable auto-completion and validation by adding |
Preview Builds
|
Summary
Support Linux ARM64 kernels with 64KB pages (RHEL aarch64, Oracle Linux, Ubuntu
generic-64k) without disabling JIT or libpas. Previously these systems hitRELEASE_ASSERTinWTF::pageSize()at startup.Upstream's
USE_64KB_PAGE_BLOCKoption disables JIT and switches to mimalloc — this patch keeps both enabled.Changes
Three commits, the first two rebased from the reverted PR #165:
0e6a06612— raise compile-time page ceilingsCeilingOnPageSize16K → 64K forOS(LINUX) && CPU(ARM64)PAS_EXPENDABLE_MEMORY_PAGE_SIZE: 16K → 64K82cc18638— derivePAS_MAX_OBJECTS_PER_PAGEfrom page sizeWas hardcoded
2048, which assumed 16K pages. With 64K pages the utility heap hasnum_alloc_bits = 64K >> 3 = 8192, overflowing the baseline allocator's bit array when a thread hitspas_baseline_allocator_attach_directoryon the slow path. This is the bug that causedthe #165 revert. Now derived:
PAS_SMALL_PAGE_DEFAULT_SIZE >> PAS_INTERNAL_MIN_ALIGN_SHIFT.d56ecd41— bumpJIT_MEDIUM_BITFIT_MIN_ALIGN_SHIFT8 → 9New bug found by static analysis.
pas_page_granule_use_countisuint8_twith 255 reserved as theDECOMMITTEDsentinel. Max objects per granule isgranule_size >> min_align_shift + 1. At64K >> 8 + 1 = 257the counter overflows; at64K >> 9 + 1 = 129it's safe.Crash-reproduced: buggy build SIGTRAPs after ~500-1000 JIT-compiled functions; fixed build passes.
Verified
granule ≥ os_page,use_count < 255,num_alloc_bits ≤ PAS_MAX_OBJECTS_PER_PAGE,num_granules ≤ PAS_MAX_GRANULESfor OS page sizes {4K, 16K, 64K}0e6a06612(both fixes absent) SIGTRAPs in phase 2Trade-off
Changes are unconditional for Linux ARM64 — a single binary runs on 4K/16K/64K kernels. On 4K-page systems (most distros, AWS Graviton):
MarkedBlock::blockSize16K → 64K (4× GC block overhead)CeilingOnPageSizeis used inalignas()andconstexpr— can't be runtime-selected without restructuringMarkedBlock.