From da74b2c159fac5fe7975c30d8bd0ec9b2cc54edc Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Wed, 16 Aug 2023 08:55:01 -0400 Subject: [PATCH] Incrementally mark even if we have free pages We move all pooled pages to free pages at the start of incremental marking, so we shouldn't run incremental marking only when we have run out of free pages. This causes incremental marking to always complete in a single step. --- gc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gc.c b/gc.c index 70b9b36d638d38..931d1e28843b8d 100644 --- a/gc.c +++ b/gc.c @@ -2347,7 +2347,7 @@ gc_continue(rb_objspace_t *objspace, rb_size_pool_t *size_pool, rb_heap_t *heap) gc_enter(objspace, gc_enter_event_continue, &lock_lev); /* Continue marking if in incremental marking. */ - if (heap->free_pages == NULL && is_incremental_marking(objspace)) { + if (is_incremental_marking(objspace)) { if (gc_marks_continue(objspace, size_pool, heap)) { gc_sweep(objspace); } @@ -2355,7 +2355,7 @@ gc_continue(rb_objspace_t *objspace, rb_size_pool_t *size_pool, rb_heap_t *heap) /* Continue sweeping if in lazy sweeping or the previous incremental * marking finished and did not yield a free page. */ - if (heap->free_pages == NULL && is_lazy_sweeping(objspace)) { + if (is_lazy_sweeping(objspace)) { gc_sweep_continue(objspace, size_pool, heap); }