alexcrichton opened PR #13830 from alexcrichton:process-madvise to bytecodealliance:main:
This commit adds support to use the
process_madvisesyscall on Linux
when decommitting regions of pages for the pooling allocator. This was
evaluated some time ago and found to be insufficient because it didn't
supportMADV_DONTNEED, but nowadays that's supported when you're
advising your own process. This makes it a perfect match for Wasmtime's
needs and itsDecommitQueue, so this PR adds bindings to it.This requires a fairly recent kernel after 6.13, and the usage of
PIDFD_SELFin the implementation additionally requires a kernel after
6.14. This is additionally disabled-by-default as this path is only
taken when the decommit batch size is larger than 1, and currently the
batch size is default to 1. In the future if this proves beneficial it
might make sense to increase the default batch size when Linux supports
this syscall behavior to something larger than 1.
alexcrichton requested fitzgen for a review on PR #13830.
alexcrichton requested wasmtime-core-reviewers for a review on PR #13830.
alexcrichton edited PR #13830:
This commit adds support to use the
process_madvisesyscall on Linux
when decommitting regions of pages for the pooling allocator. This was
evaluated some time ago and found to be insufficient because it didn't
supportMADV_DONTNEED, but nowadays that's supported when you're
advising your own process. This makes it a perfect match for Wasmtime's
needs and itsDecommitQueue, so this PR adds bindings to it.This requires a fairly recent kernel after 6.13, and the usage of
PIDFD_SELFin the implementation additionally requires a kernel after
6.14. This is additionally disabled-by-default as this path is only
taken when the decommit batch size is larger than 1, and currently the
batch size is default to 1. In the future if this proves beneficial it
might make sense to increase the default batch size when Linux supports
this syscall behavior to something larger than 1.Note: this is currently built on #13827
fitzgen commented on PR #13830:
Out of curiosity, did you measure any speedups on e.g.
benches/wasmtime-serve-rps.shwith this change?
:thumbs_up: fitzgen submitted PR review:
Second commit LGTM!
alexcrichton commented on PR #13830:
Locally in
perfprofiles I can see IPI contention disappear entirely, but it's replaced by contention on the pooling allocator lock. The script locally decreases from 192k to 185k with this change (and when the batch size is increased to >=8). I'm gonna dig a little bit into the contention and see if there's something we can do about it.
github-actions[bot] added the label wasmtime:api on PR #13830.
alexcrichton updated PR #13830.
alexcrichton has enabled auto merge for PR #13830.
alexcrichton updated PR #13830.
alexcrichton added PR #13830 Optionally use process_madvise on Linux to the merge queue.
:check: alexcrichton merged PR #13830.
alexcrichton removed PR #13830 Optionally use process_madvise on Linux from the merge queue.
Last updated: Jul 29 2026 at 05:03 UTC