Read an overflowed buffer's placement only where it lies in the runtime's own pages

own_pages_overflowed went through OwnBytes::with, which for a buffer over
host pages reads them for ReadApart::Binding and keeps the import for good;
every program buffer is now asked, so that would be a side effect on each.
It now reads Lie::Fixed pages only, as in_fresh_pages does: host pages are
imported and never overflow.

Verified: nothing yet (cargo fmt only).
(cherry picked from commit 77702ceef4f18d30cfe32499fd3be25729e49bcb)
This commit is contained in:
Anees Iqbal committed 2026-11-05 02:08:31 -08:00
1 parent 8ccb2934c9
commit a720be9cf5
1 file changed
+7 -6
+7 -6
View File
@@ -2807,14 +2807,15 @@ impl Buffer {
}
/// Whether the buffer's own pages, of the runtime's memory, overflowed past device-local memory
/// into system memory (`memory.rs`'s `overflow_candidates`); false for a heap's buffer, whose
/// bytes are its heap's.
/// into system memory (`memory.rs`'s `overflow_candidates`): false for a buffer over host
/// pages, which are imported, and for a heap's buffer, whose bytes are its heap's.
pub(super) fn own_pages_overflowed(&self) -> bool {
match &self.0.bytes {
Bytes::Own(own) => own.with(ReadApart::Binding, |pages| {
pages.memory.placement.overflowed()
}),
Bytes::Heap(_) => false,
Bytes::Own(OwnBytes {
lie: Lie::Fixed(fixed),
..
}) => fixed.pages.memory.placement.overflowed(),
Bytes::Own(_) | Bytes::Heap(_) => false,
}
}