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.0 required=3.0 tests=ALL_TRUSTED,AWL,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 B0D101FA00 for ; Mon, 19 Dec 2022 11:19:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1671448763; bh=sN48Nmn6QMqgYCiqZF0ZByrcNnEm4b6BrKeGvZ4ZUXo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jLgJZXjqd+Glg8x2CFmhSaVz2sJO+ZDI1M9XlHQ+c9KQM7cJKisHHp8hHwSMMRpP7 8Yc90gsFUiQHYY6ccyzWXM1AZll9AJ+k+mGAPUKGR9Ydyo9fnEq1/nGsxWEMZCHYU3 /UlehJfSt8534a0o9H/tRHMNEOYK02e3SPmV1Pzc= From: Eric Wong To: mwrap-perl@80x24.org Subject: [PATCH 3/7] core: drop FreeBSD-specific mutex initialization Date: Mon, 19 Dec 2022 11:19:18 +0000 Message-Id: <20221219111922.1079128-4-e@80x24.org> In-Reply-To: <20221219111922.1079128-1-e@80x24.org> References: <20221219111922.1079128-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: From: Eric Wong It's no longer needed with our embedded malloc and our non-glibc ensure_initialization() mutex avoidance hack. --- mwrap_core.h | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/mwrap_core.h b/mwrap_core.h index 7f52f39..b382018 100644 --- a/mwrap_core.h +++ b/mwrap_core.h @@ -87,18 +87,11 @@ union padded_mutex { char pad[64]; /* cache alignment for common CPUs */ }; -/* a round-robin pool of mutexes */ +/* a pool of mutexes for all "struct src_loc" */ #define MUTEX_NR (1 << 6) #define MUTEX_MASK (MUTEX_NR - 1) -#ifdef __FreeBSD__ -# define STATIC_MTX_INIT_OK (0) -#else /* only tested on Linux + glibc */ -# define STATIC_MTX_INIT_OK (1) -#endif static union padded_mutex mutexes[MUTEX_NR] = { -#if STATIC_MTX_INIT_OK [0 ... (MUTEX_NR-1)].mtx = PTHREAD_MUTEX_INITIALIZER -#endif }; #ifdef static_assert @@ -1010,12 +1003,6 @@ __attribute__((constructor)) static void mwrap_ctor(void) ensure_initialization(); CHECK(int, 0, pthread_key_create(&tlskey, mstate_tsd_dtor)); - /* - * PTHREAD_MUTEX_INITIALIZER on FreeBSD means lazy initialization, - * which happens at pthread_mutex_lock, and that calls calloc - */ - if (!STATIC_MTX_INIT_OK) - reset_mutexes(); /* initialize mutexes used by urcu-bp */ CMM_STORE_SHARED(files, lfht_new(256)); if (!CMM_LOAD_SHARED(files))