Skip to content

Add noreserve parameter to allocate_pages and fix copy_pages chunk length#754

Open
wdcui wants to merge 1 commit intomainfrom
wdcui/pr3d-noreserve
Open

Add noreserve parameter to allocate_pages and fix copy_pages chunk length#754
wdcui wants to merge 1 commit intomainfrom
wdcui/pr3d-noreserve

Conversation

@wdcui
Copy link
Copy Markdown
Member

@wdcui wdcui commented Apr 7, 2026

Summary

  • Add noreserve: bool parameter to PageManagementProvider::allocate_pages(). When true, Linux userland uses MAP_NORESERVE for sparse memory reservations. Kernel, LVBS, and Windows platforms accept but ignore it. All current callers pass false (no behavior change).
  • Fix a bug in the default remap_pages() copy loop: to_owned_slice() was using old_range.len() (the entire range) instead of per-chunk length, reading beyond each chunk boundary.

Split from #743.

…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.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

🤖 SemverChecks 🤖 ⚠️ Potential breaking API changes detected ⚠️

Click for details
--- failure trait_method_parameter_count_changed: pub trait method parameter count changed ---

Description:
A trait method now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#trait-item-signature
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/trait_method_parameter_count_changed.ron

Failed in:
  PageManagementProvider::allocate_pages now takes 6 instead of 5 parameters, in file /home/runner/work/litebox/litebox/litebox/src/platform/page_mgmt.rs:63
  PageManagementProvider::allocate_pages now takes 6 instead of 5 parameters, in file /home/runner/work/litebox/litebox/litebox/src/platform/page_mgmt.rs:63

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant