Skip to content

Commit c4ca2a8

Browse files
authored
Remove unused mapped_rgns field from memory manager (#1510)
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
1 parent 9e98c10 commit c4ca2a8

3 files changed

Lines changed: 0 additions & 8 deletions

File tree

src/hyperlight_host/src/mem/mgr.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ pub(crate) struct SandboxMemoryManager<S: SharedMemory> {
145145
pub(crate) layout: SandboxMemoryLayout,
146146
/// Offset for the execution entrypoint from `load_addr`
147147
pub(crate) entrypoint: NextAction,
148-
/// How many memory regions were mapped after sandbox creation
149-
pub(crate) mapped_rgns: u64,
150148
/// Buffer for accumulating guest abort messages
151149
pub(crate) abort_buffer: Vec<u8>,
152150
/// Generation counter: how many snapshots have been taken from
@@ -287,7 +285,6 @@ where
287285
shared_mem,
288286
scratch_mem,
289287
entrypoint,
290-
mapped_rgns: 0,
291288
abort_buffer: Vec::new(),
292289
snapshot_count: 0,
293290
}
@@ -364,7 +361,6 @@ impl SandboxMemoryManager<ExclusiveSharedMemory> {
364361
scratch_mem: hscratch,
365362
layout: self.layout,
366363
entrypoint: self.entrypoint,
367-
mapped_rgns: self.mapped_rgns,
368364
abort_buffer: self.abort_buffer,
369365
snapshot_count: self.snapshot_count,
370366
};
@@ -373,7 +369,6 @@ impl SandboxMemoryManager<ExclusiveSharedMemory> {
373369
scratch_mem: gscratch,
374370
layout: self.layout,
375371
entrypoint: self.entrypoint,
376-
mapped_rgns: self.mapped_rgns,
377372
abort_buffer: Vec::new(), // Guest doesn't need abort buffer
378373
snapshot_count: self.snapshot_count,
379374
};

src/hyperlight_host/src/sandbox/initialized_multi_use.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,6 @@ impl MultiUseSandbox {
755755
// Map first so overlaps are rejected before resetting the snapshot
756756
unsafe { self.vm.map_region(rgn) }.map_err(HyperlightVmError::MapRegion)?;
757757
self.snapshot = None;
758-
self.mem_mgr.mapped_rgns += 1;
759758
Ok(())
760759
}
761760

@@ -842,7 +841,6 @@ impl MultiUseSandbox {
842841
// On Linux the hypervisor holds a reference to the host mmap;
843842
// freeing it here would leave a dangling backing.
844843
prepared.mark_consumed();
845-
self.mem_mgr.mapped_rgns += 1;
846844

847845
// Record the mapping metadata in the PEB. If this fails the VM
848846
// still holds a valid mapping but the PEB won't list it — the

src/hyperlight_host/src/sandbox/uninitialized_evolve.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ pub(super) fn evolve_impl_multi_use(u_sbox: UninitializedSandbox) -> Result<Mult
116116
// UninitializedSandbox::map_file_cow.
117117
#[cfg(feature = "nanvix-unstable")]
118118
hshm.write_file_mapping_entry(prepared.guest_base, prepared.size as u64, &prepared.label)?;
119-
hshm.mapped_rgns += 1;
120119
}
121120

122121
vm.initialise(

0 commit comments

Comments
 (0)