Skip to content

Commit

Permalink
revert to 1.8 heuristics
Browse files Browse the repository at this point in the history
  • Loading branch information
d-netto committed Oct 16, 2023
1 parent 110e9ba commit e839b04
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 228 deletions.
35 changes: 1 addition & 34 deletions src/gc-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -953,29 +953,6 @@ void gc_time_sweep_pause(uint64_t gc_end_t, int64_t actual_allocd,
jl_ns2ms(gc_postmark_end - gc_premark_end),
sweep_full ? "full" : "quick", -gc_num.allocd / 1024);
}

void gc_time_summary(int sweep_full, uint64_t start, uint64_t end,
uint64_t freed, uint64_t live, uint64_t interval,
uint64_t pause, uint64_t ttsp, uint64_t mark,
uint64_t sweep)
{
if (sweep_full > 0)
jl_safe_printf("TS: %" PRIu64 " Major collection: estimate freed = %" PRIu64
" live = %" PRIu64 "m new interval = %" PRIu64
"m time = %" PRIu64 "ms ttsp = %" PRIu64 "us mark time = %"
PRIu64 "ms sweep time = %" PRIu64 "ms \n",
end, freed, live/1024/1024,
interval/1024/1024, pause/1000000, ttsp,
mark/1000000,sweep/1000000);
else
jl_safe_printf("TS: %" PRIu64 " Minor collection: estimate freed = %" PRIu64
" live = %" PRIu64 "m new interval = %" PRIu64 "m pause time = %"
PRIu64 "ms ttsp = %" PRIu64 "us mark time = %" PRIu64
"ms sweep time = %" PRIu64 "ms \n",
end, freed, live/1024/1024,
interval/1024/1024, pause/1000000, ttsp,
mark/1000000,sweep/1000000);
}
#endif

void jl_gc_debug_init(void)
Expand Down Expand Up @@ -1219,7 +1196,7 @@ JL_DLLEXPORT void jl_enable_gc_logging(int enable) {
gc_logging_enabled = enable;
}

void _report_gc_finished(uint64_t pause, uint64_t freed, int full, int recollect, int64_t live_bytes) JL_NOTSAFEPOINT {
void _report_gc_finished(uint64_t pause, uint64_t freed, int full, int recollect) JL_NOTSAFEPOINT {
if (!gc_logging_enabled) {
return;
}
Expand All @@ -1228,16 +1205,6 @@ void _report_gc_finished(uint64_t pause, uint64_t freed, int full, int recollect
full ? "full" : "incr",
recollect ? "recollect" : ""
);

jl_safe_printf("Heap stats: bytes_mapped %.2f MB, bytes_resident %.2f MB,\nheap_size %.2f MB, heap_target %.2f MB, Fragmentation %.3f\n",
jl_atomic_load_relaxed(&gc_heap_stats.bytes_mapped)/(double)(1<<20),
jl_atomic_load_relaxed(&gc_heap_stats.bytes_resident)/(double)(1<<20),
// live_bytes/(double)(1<<20), live byes tracking is not accurate.
jl_atomic_load_relaxed(&gc_heap_stats.heap_size)/(double)(1<<20),
jl_atomic_load_relaxed(&gc_heap_stats.heap_target)/(double)(1<<20),
(double)live_bytes/(double)jl_atomic_load_relaxed(&gc_heap_stats.heap_size)
);
// Should fragmentation use bytes_resident instead of heap_size?
}

#ifdef __cplusplus
Expand Down
4 changes: 0 additions & 4 deletions src/gc-pages.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ char *jl_gc_try_alloc_pages_(int pg_cnt) JL_NOTSAFEPOINT
// round data pointer up to the nearest gc_page_data-aligned
// boundary if mmap didn't already do so.
mem = (char*)gc_page_data(mem + GC_PAGE_SZ - 1);
jl_atomic_fetch_add_relaxed(&gc_heap_stats.bytes_mapped, pages_sz);
jl_atomic_fetch_add_relaxed(&gc_heap_stats.bytes_resident, pages_sz);
return mem;
}

Expand Down Expand Up @@ -117,7 +115,6 @@ NOINLINE jl_gc_pagemeta_t *jl_gc_alloc_page(void) JL_NOTSAFEPOINT
// try to get page from `pool_freed`
meta = pop_lf_page_metadata_back(&global_page_pool_freed);
if (meta != NULL) {
jl_atomic_fetch_add_relaxed(&gc_heap_stats.bytes_resident, GC_PAGE_SZ);
gc_alloc_map_set(meta->data, GC_PAGE_ALLOCATED);
goto exit;
}
Expand Down Expand Up @@ -191,7 +188,6 @@ void jl_gc_free_page(jl_gc_pagemeta_t *pg) JL_NOTSAFEPOINT
madvise(p, decommit_size, MADV_DONTNEED);
#endif
msan_unpoison(p, decommit_size);
jl_atomic_fetch_add_relaxed(&gc_heap_stats.bytes_resident, -decommit_size);
}

#ifdef __cplusplus
Expand Down
Loading

0 comments on commit e839b04

Please sign in to comment.