Add noreserve parameter to allocate_pages and fix copy_pages chunk length#754
Add noreserve parameter to allocate_pages and fix copy_pages chunk length#754
Conversation
…ngth Two changes to page_mgmt: 1. Add a 'noreserve' bool parameter to PageManagementProvider::allocate_pages(). When true, platforms that support it (Linux userland via MAP_NORESERVE) avoid reserving swap/commit upfront, enabling sparse memory reservations. Kernel, LVBS, and Windows platforms accept but ignore the parameter. All callers currently pass false (no behavior change). 2. Fix a bug in the default remap_pages() copy loop: the to_owned_slice() call was using old_range.len() (the entire range length) instead of the per-chunk length, causing each iteration to read beyond its chunk boundary.
|
🤖 SemverChecks 🤖 Click for details |
jaybosamiya-ms
left a comment
There was a problem hiding this comment.
The description needs to be updated to document what this might be used for.
Is it primarily to provide NORESERVE to a Linux shim? If so, I don't think this PR is a good one to merge. This is because it can cause some programs to seem like they work on Linux platform, and then break when you migrate it to a different platform. If the shim-level NORESERVE is the question, why not just squash it there, and force reservation? Are there actual programs that break if you do it through forced reservation? What is the plan to handle those programs on a Linux-on-Windows or similar scenario?
Also, minor nit: the number of boolean parameters to this particular function has now gone up once more; this means that every callee of it is (yet again) slightly harder to read. Does not need to be fixed in this PR, just making a note.
Summary
noreserve: boolparameter toPageManagementProvider::allocate_pages(). When true, Linux userland usesMAP_NORESERVEfor sparse memory reservations. Kernel, LVBS, and Windows platforms accept but ignore it. All current callers passfalse(no behavior change).remap_pages()copy loop:to_owned_slice()was usingold_range.len()(the entire range) instead of per-chunk length, reading beyond each chunk boundary.Split from #743.