From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 5570421847 for ; Fri, 18 May 2018 08:58:25 +0000 (UTC) From: Eric Wong To: spew@80x24.org Subject: [PATCH 8/8] gc.c: lower sweep unlink limit and make tunable in gc.h Date: Fri, 18 May 2018 08:58:19 +0000 Message-Id: <20180518085819.14892-9-e@80x24.org> In-Reply-To: <20180518085819.14892-1-e@80x24.org> References: <20180518085819.14892-1-e@80x24.org> List-Id: Sweeping and unlinking too many pages at once during a lazy sweep step can delay IO readiness checks. So count on sweeping more frequently and keep more pages in the eden heap. --- gc.c | 2 +- gc.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gc.c b/gc.c index dbc3681f51..5e10d8373e 100644 --- a/gc.c +++ b/gc.c @@ -3693,7 +3693,7 @@ static int gc_sweep_step(rb_objspace_t *objspace, rb_heap_t *heap) { struct heap_page *sweep_page = heap->sweeping_page; - int unlink_limit = 3; + int unlink_limit = RUBY_GC_UNLINK_LIMIT; #if GC_ENABLE_INCREMENTAL_MARK int need_pool = will_be_incremental_marking(objspace) ? TRUE : FALSE; diff --git a/gc.h b/gc.h index 6e1fc5dccc..939bd84bb6 100644 --- a/gc.h +++ b/gc.h @@ -102,6 +102,9 @@ struct rb_execution_context_struct; #ifndef RUBY_GC_SLEEPY_START # define RUBY_GC_SLEEPY_START 1 #endif +#ifndef RUBY_GC_UNLINK_LIMIT +# define RUBY_GC_UNLINK_LIMIT 1 +#endif #if RUBY_GC_SLEEPY_SWEEP || RUBY_GC_SLEEPY_MARK || RUBY_GC_SLEEPY_START int rb_gc_inprogress(const struct rb_execution_context_struct *); -- EW