mwrap (Perl version) user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: mwrap-perl@80x24.org
Subject: [PATCH] mwrap_core: do not manually resize lfht
Date: Fri,  2 Dec 2022 10:16:17 +0000	[thread overview]
Message-ID: <20221202101617.819881-1-e@80x24.org> (raw)

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 <execinfo.h>
@@ -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));

                 reply	other threads:[~2022-12-02 10:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221202101617.819881-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=mwrap-perl@80x24.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mwrap-perl.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).