Skip to content

Commit

Permalink
Use live memory to estimate collection pages in mem balancer (#1050)
Browse files Browse the repository at this point in the history
This PR fixes #918. We
misinterpreted 'bytes collected during collection' in the paper, and
used reclaimed pages for it. It actually means 'bytes that are traversed
during collection'. We now use live pages to estimate the value.
  • Loading branch information
qinsoon authored Jan 16, 2024
1 parent 2b132cf commit ef2bd6d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/util/heap/gc_trigger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ struct MemBalancerStats {
allocation_pages: f64,
/// Allocation duration in secs
allocation_time: f64,
/// Collected memory in pages
/// Collected memory in pages (memory traversed during collection)
collection_pages: f64,
/// Collection duration in secs
collection_time: f64,
Expand Down Expand Up @@ -289,9 +289,8 @@ impl MemBalancerStats {
) -> bool {
if !plan.is_current_gc_nursery() {
self.gc_end_live_pages = plan.get_mature_reserved_pages();
self.collection_pages = self
.gc_release_live_pages
.saturating_sub(self.gc_end_live_pages) as f64;
// Use live pages as an estimate for pages traversed during GC
self.collection_pages = self.gc_end_live_pages as f64;
trace!(
"collected pages = mature live at gc end {} - mature live at gc release {} = {}",
self.gc_release_live_pages,
Expand Down Expand Up @@ -327,9 +326,8 @@ impl MemBalancerStats {
fn non_generational_mem_stats_on_gc_end<VM: VMBinding>(&mut self, mmtk: &'static MMTK<VM>) {
self.gc_end_live_pages = mmtk.get_plan().get_reserved_pages();
trace!("live pages = {}", self.gc_end_live_pages);
self.collection_pages = self
.gc_release_live_pages
.saturating_sub(self.gc_end_live_pages) as f64;
// Use live pages as an estimate for pages traversed during GC
self.collection_pages = self.gc_end_live_pages as f64;
trace!(
"collected pages = live at gc end {} - live at gc release {} = {}",
self.gc_release_live_pages,
Expand Down

0 comments on commit ef2bd6d

Please sign in to comment.