Skip to content

Commit 3b97715

Browse files
authored
Test for reverting back to 1.8 GC heuristics (#51661)
The 1.10 GC heuristics introduced in #50144 have been a source of concerning issues such as #50705 and #51601. The PR also doesn't correctly implement the paper on which it's based, as discussed in #51498. Test whether the 1.8 GC heuristics are a viable option.
1 parent d4809e5 commit 3b97715

File tree

5 files changed

+77
-228
lines changed

5 files changed

+77
-228
lines changed

src/gc-debug.c

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -953,29 +953,6 @@ void gc_time_sweep_pause(uint64_t gc_end_t, int64_t actual_allocd,
953953
jl_ns2ms(gc_postmark_end - gc_premark_end),
954954
sweep_full ? "full" : "quick", -gc_num.allocd / 1024);
955955
}
956-
957-
void gc_time_summary(int sweep_full, uint64_t start, uint64_t end,
958-
uint64_t freed, uint64_t live, uint64_t interval,
959-
uint64_t pause, uint64_t ttsp, uint64_t mark,
960-
uint64_t sweep)
961-
{
962-
if (sweep_full > 0)
963-
jl_safe_printf("TS: %" PRIu64 " Major collection: estimate freed = %" PRIu64
964-
" live = %" PRIu64 "m new interval = %" PRIu64
965-
"m time = %" PRIu64 "ms ttsp = %" PRIu64 "us mark time = %"
966-
PRIu64 "ms sweep time = %" PRIu64 "ms \n",
967-
end, freed, live/1024/1024,
968-
interval/1024/1024, pause/1000000, ttsp,
969-
mark/1000000,sweep/1000000);
970-
else
971-
jl_safe_printf("TS: %" PRIu64 " Minor collection: estimate freed = %" PRIu64
972-
" live = %" PRIu64 "m new interval = %" PRIu64 "m pause time = %"
973-
PRIu64 "ms ttsp = %" PRIu64 "us mark time = %" PRIu64
974-
"ms sweep time = %" PRIu64 "ms \n",
975-
end, freed, live/1024/1024,
976-
interval/1024/1024, pause/1000000, ttsp,
977-
mark/1000000,sweep/1000000);
978-
}
979956
#endif
980957

981958
void jl_gc_debug_init(void)
@@ -1219,7 +1196,7 @@ JL_DLLEXPORT void jl_enable_gc_logging(int enable) {
12191196
gc_logging_enabled = enable;
12201197
}
12211198

1222-
void _report_gc_finished(uint64_t pause, uint64_t freed, int full, int recollect, int64_t live_bytes) JL_NOTSAFEPOINT {
1199+
void _report_gc_finished(uint64_t pause, uint64_t freed, int full, int recollect) JL_NOTSAFEPOINT {
12231200
if (!gc_logging_enabled) {
12241201
return;
12251202
}
@@ -1228,16 +1205,6 @@ void _report_gc_finished(uint64_t pause, uint64_t freed, int full, int recollect
12281205
full ? "full" : "incr",
12291206
recollect ? "recollect" : ""
12301207
);
1231-
1232-
jl_safe_printf("Heap stats: bytes_mapped %.2f MB, bytes_resident %.2f MB,\nheap_size %.2f MB, heap_target %.2f MB, Fragmentation %.3f\n",
1233-
jl_atomic_load_relaxed(&gc_heap_stats.bytes_mapped)/(double)(1<<20),
1234-
jl_atomic_load_relaxed(&gc_heap_stats.bytes_resident)/(double)(1<<20),
1235-
// live_bytes/(double)(1<<20), live byes tracking is not accurate.
1236-
jl_atomic_load_relaxed(&gc_heap_stats.heap_size)/(double)(1<<20),
1237-
jl_atomic_load_relaxed(&gc_heap_stats.heap_target)/(double)(1<<20),
1238-
(double)live_bytes/(double)jl_atomic_load_relaxed(&gc_heap_stats.heap_size)
1239-
);
1240-
// Should fragmentation use bytes_resident instead of heap_size?
12411208
}
12421209

12431210
#ifdef __cplusplus

src/gc-pages.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ char *jl_gc_try_alloc_pages_(int pg_cnt) JL_NOTSAFEPOINT
5252
// round data pointer up to the nearest gc_page_data-aligned
5353
// boundary if mmap didn't already do so.
5454
mem = (char*)gc_page_data(mem + GC_PAGE_SZ - 1);
55-
jl_atomic_fetch_add_relaxed(&gc_heap_stats.bytes_mapped, pages_sz);
56-
jl_atomic_fetch_add_relaxed(&gc_heap_stats.bytes_resident, pages_sz);
5755
return mem;
5856
}
5957

@@ -117,7 +115,6 @@ NOINLINE jl_gc_pagemeta_t *jl_gc_alloc_page(void) JL_NOTSAFEPOINT
117115
// try to get page from `pool_freed`
118116
meta = pop_lf_page_metadata_back(&global_page_pool_freed);
119117
if (meta != NULL) {
120-
jl_atomic_fetch_add_relaxed(&gc_heap_stats.bytes_resident, GC_PAGE_SZ);
121118
gc_alloc_map_set(meta->data, GC_PAGE_ALLOCATED);
122119
goto exit;
123120
}
@@ -191,7 +188,6 @@ void jl_gc_free_page(jl_gc_pagemeta_t *pg) JL_NOTSAFEPOINT
191188
madvise(p, decommit_size, MADV_DONTNEED);
192189
#endif
193190
msan_unpoison(p, decommit_size);
194-
jl_atomic_fetch_add_relaxed(&gc_heap_stats.bytes_resident, -decommit_size);
195191
}
196192

197193
#ifdef __cplusplus

0 commit comments

Comments
 (0)