Skip to content

perf: pick compacted-region base addresses outside ASLR-occupied zones#14563

Draft
sgraf812 wants to merge 1 commit into
masterfrom
sg/olean-base-window
Draft

perf: pick compacted-region base addresses outside ASLR-occupied zones#14563
sgraf812 wants to merge 1 commit into
masterfrom
sg/olean-base-window

Conversation

@sgraf812

Copy link
Copy Markdown
Contributor

This PR draws the base addresses recorded in compacted-region files from [0x080000000000, 0x550000000000) instead of [0, 0x7f0000000000), so that loading an .olean or incremental snapshot succeeds with a plain mmap at the recorded address instead of falling back to the pointer-relocation walk.

The previous window overlaps the zones ASLR populates: the PIE executable and heap above 0x555555554000, and the kernel's top-down mmap area holding shared libraries, thread stacks, and allocator arenas, which reaches down to about 0x700000000000 under high-entropy ASLR (mmap_rnd_bits = 32). A region base inside those zones fails the load-time mmap depending on the run's ASLR offsets, and a single failed dependency region forces relocating every pointer into it. compiled/incr_header_load shows the effect as bimodality: 454M instructions when every region maps at its recorded base, 826M and +70MiB resident when the relocation walk runs, with the slow mode hit in roughly a quarter of runs; an mmap trace census over 40 runs places every collision between 0x70… and 0x76…, inside thread-stack and arena reservations, and none inside the new window across ~196k fixed-address mappings.

Bases are baked into files at save time, so the change takes effect for newly written files; existing files load unchanged through the relocation fallback.

Region base addresses are drawn from [0x080000000000, 0x550000000000) instead of [0, 0x7f0000000000), keeping them clear of the PIE executable and heap above 0x555555554000 and of the top-down mmap area that holds shared libraries, thread stacks, and allocator arenas, which reaches down to about 0x700000000000 under high-entropy ASLR. Bases inside those zones make the load-time mmap fail depending on the run's ASLR offsets, forcing the pointer-relocation fallback for the region.
@sgraf812 sgraf812 added the changelog-compiler Compiler, runtime, and FFI label Jul 27, 2026
@sgraf812

Copy link
Copy Markdown
Contributor Author

!bench

@leanprover-radar

leanprover-radar commented Jul 27, 2026

Copy link
Copy Markdown

Benchmark results for 30883a2 against 76e5ec5 are in. No significant results found. @sgraf812

  • 🟥 build//instructions: +176.2M (+0.00%)

Small changes (3✅, 1🟥)

  • 🟥 compiled/deriv//maxrss: +383kiB (+0.07%)
  • compiled/ilean_roundtrip//maxrss: -4MiB (-0.76%)
  • compiled/io_compute//task-clock: -87ms (-3.97%)
  • compiled/io_compute//wall-clock: -87ms (-3.95%)

@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Jul 27, 2026
@mathlib-lean-pr-testing

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 76e5ec53d211e9c6d8aec071bb427bc482515d3d --onto b4fb9a75e9e1cfc8d936ee6a574a8b537662698b. You can force Mathlib CI using the force-mathlib-ci label. (2026-07-27 10:35:26)

@leanprover-bot

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 76e5ec53d211e9c6d8aec071bb427bc482515d3d --onto b4fb9a75e9e1cfc8d936ee6a574a8b537662698b. You can force reference manual CI using the force-manual-ci label. (2026-07-27 10:35:27)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-compiler Compiler, runtime, and FFI toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants