Skip to content

kernel: copy-on-write memory images for linear-memory initialisation on every backend #570

Open

Description

@lexoliu

Every backend opts out of Wasmtime's memory images (x86/src/vmm.rs:1317-1331, aarch64/src/vmm.rs:1665-1677, riscv/src/vmm.rs:1449-1457), so every instantiate copies the module's data segments and the pooling allocator's warm slots have no image to keep mapped. On x86 KVM a warm CPython launch spends 9.25 ms of its 9.7 ms pre-guest time in store_prepare → instantiate (run 34557036286).

Scope

  • A hal VMM capability that maps a run of frames copy-on-write into a reserved range.
  • The write-fault path copies the frame, replaces the translation, and shoots it down.
  • Each backend implements memory_image_new, memory_image_map_at and memory_image_free over that capability, with the image's frames charged to user memory.

Done when

  • A paired bench-suite.yml run shows instance-startup-1 and the warm launch window's store_prepare → instantiate moving, beyond the noise floor, citing the control row.
  • Unit tests on hosted/ cover a write to a shared page leaving the image unchanged and a second instance seeing the original bytes.

Activity

  1. added
    perf
    memory
    on Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    memoryperf

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions