Skip to content

Make memfd image creation lazy (on first instantiation).#3760

Merged
cfallin merged 1 commit into
bytecodealliance:mainfrom
cfallin:memfd-lazy-create
Feb 3, 2022
Merged

Make memfd image creation lazy (on first instantiation).#3760
cfallin merged 1 commit into
bytecodealliance:mainfrom
cfallin:memfd-lazy-create

Conversation

@cfallin
Copy link
Copy Markdown
Member

@cfallin cfallin commented Feb 2, 2022

As a followup to the recent memfd allocator work, this PR makes the
memfd image creation occur on the first instantiation, rather than
immediately when the Module is loaded.

This shaves off a potentially surprising cost spike that would have
otherwise occurred: prior to the memfd work, no allocator eagerly read
the module's initial heap state into RAM. The behavior should now more
closely resemble what happened before (and the improvements in overall
instantiation time and performance, as compared to either eager init
with pure-mmap memory or user-mode pagefault handling with uffd,
remain).

@cfallin cfallin requested a review from alexcrichton February 2, 2022 23:59
@github-actions github-actions Bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Feb 3, 2022
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 3, 2022

Subscribe to Label Action

cc @peterhuene

Details This issue or pull request has been labeled: "wasmtime:api"

Thus the following users have been cc'd because of the following labels:

  • peterhuene: wasmtime:api

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

Copy link
Copy Markdown
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me!

Comment thread crates/wasmtime/src/module.rs Outdated
As a followup to the recent memfd allocator work, this PR makes the
memfd image creation occur on the first instantiation, rather than
immediately when the `Module` is loaded.

This shaves off a potentially surprising cost spike that would have
otherwise occurred: prior to the memfd work, no allocator eagerly read
the module's initial heap state into RAM. The behavior should now more
closely resemble what happened before (and the improvements in overall
instantiation time and performance, as compared to either eager init
with pure-mmap memory or user-mode pagefault handling with uffd,
remain).
@cfallin cfallin merged commit b3b83ef into bytecodealliance:main Feb 3, 2022
@cfallin cfallin deleted the memfd-lazy-create branch February 3, 2022 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasmtime:api Related to the API of the `wasmtime` crate itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants