mwrap (Perl version) user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [PATCH] mwrap_core: do not manually resize lfht
@ 2022-12-02 10:16 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2022-12-02 10:16 UTC (permalink / raw)
  To: mwrap-perl

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));

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-02 10:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-02 10:16 [PATCH] mwrap_core: do not manually resize lfht Eric Wong

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).