From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 9D6831F601 for ; Fri, 2 Dec 2022 10:16:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1669976177; bh=U1a8R3s1yXi/2JATN2Ku1lByrDWmFCbIFS4A3ULQbhU=; h=From:To:Subject:Date:From; b=vqR8kAf/AC64ZckKnCJDNRvNHk9ic36ZQllfPncJqgte910qVOekP9wzIqiCU5u1p hfsL94CzziIvmzL3ZvcamOaK1jt3W/L1jGVxhYeQMQ5DjBAx6mlnIfCf7zfVq3mIB0 AZSVxfdmaT/axBvRkxiJnjPdh1Qh7cfBywwRYcFI= From: Eric Wong To: mwrap-perl@80x24.org Subject: [PATCH] mwrap_core: do not manually resize lfht Date: Fri, 2 Dec 2022 10:16:17 +0000 Message-Id: <20221202101617.819881-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: URCU actually uses a workqueue that pre-spawns a thread at creation time, so we're safe as long as we call cds_lfht_new while signals are blocked. --- mwrap_core.h | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/mwrap_core.h b/mwrap_core.h index 9b771d2..e7723c2 100644 --- a/mwrap_core.h +++ b/mwrap_core.h @@ -15,20 +15,6 @@ # include "XSUB.h" # include "embed.h" # include "ppport.h" -# ifndef MWRAP_EARLY_THREADS -# define MWRAP_EARLY_THREADS 1 -# endif -#endif - -/* - * Start URCU threads early for runtimes (e.g. Perl) which leave - * signals unblocked. This isn't needed for (C)Ruby since it - * currently runs with all signals blocked. - * Needed for URCU prior to commit ea3a28a3f71dd02fb34ed4e3108f93275dbef89a - * ("Disable signals in URCU background threads" 2022-09-23) - */ -#ifndef MWRAP_EARLY_THREADS -# define MWRAP_EARLY_THREADS 0 #endif #include @@ -109,8 +95,7 @@ static pthread_mutex_t *mutex_assign(void) static struct cds_lfht *lfht_new(void) { - unsigned long size = MWRAP_EARLY_THREADS ? 8192 : 16384; - return cds_lfht_new(size, 1, 0, CDS_LFHT_AUTO_RESIZE, 0); + return cds_lfht_new(16384, 1, 0, CDS_LFHT_AUTO_RESIZE, 0); } static void reset_mutexes(void) @@ -778,10 +763,6 @@ __attribute__((constructor)) static void mwrap_ctor(void) } else fprintf(stderr, "malloc failed: %s\n", strerror(errno)); - /* start background threads before unblocking signals */ - if (MWRAP_EARLY_THREADS) - cds_lfht_resize(CMM_LOAD_SHARED(totals), 16384); - CHECK(int, 0, pthread_sigmask(SIG_SETMASK, &old, NULL)); CHECK(int, 0, pthread_atfork(atfork_prepare, atfork_parent, atfork_child));