From 5d95844f496166ee54838796c013d7ee5a1ec6ce Mon Sep 17 00:00:00 2001 From: Olivier Certner Date: Thu, 7 Jan 2021 20:28:40 +0100 Subject: Revert "Issue #1699 - Part 3a: mozjemalloc: Memory barriers on 'malloc_initialized'" This reverts commit f76695c1ce032b634f3e0e2a593aebdd1d49703b. SUSv4 specifies that 'pthread_create' acts as a (full) memory barrier, so barriers here are not necessary. --- memory/mozjemalloc/jemalloc.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/memory/mozjemalloc/jemalloc.c b/memory/mozjemalloc/jemalloc.c index 494e820990..bbd68365b5 100644 --- a/memory/mozjemalloc/jemalloc.c +++ b/memory/mozjemalloc/jemalloc.c @@ -4758,7 +4758,7 @@ huge_dalloc(void *ptr) base_node_dealloc(node); } -/* +/* * Platform-specific methods to determine the number of CPUs in a system. * This will be used to determine the desired number of arenas. */ @@ -4845,7 +4845,7 @@ static inline unsigned malloc_ncpus(void) { SYSTEM_INFO info; - + GetSystemInfo(&info); return (info.dwNumberOfProcessors); } @@ -5246,7 +5246,6 @@ malloc_init_hard(void) malloc_mutex_lock(&init_lock); #endif -#ifndef __FreeBSD__ if (malloc_initialized) { /* * Another thread initialized the allocator before this one @@ -5257,11 +5256,6 @@ malloc_init_hard(void) #endif return (false); } -#else - if (__atomic_load_n(&malloc_initialized, __ATOMIC_ACQUIRE)) { - return (false); - } -#endif #ifdef MOZ_MEMORY_WINDOWS /* get a thread local storage index */ @@ -5687,11 +5681,7 @@ MALLOC_OUT: if (chunk_rtree == NULL) return (true); -#ifndef __FreeBSD__ malloc_initialized = true; -#else - __atomic_store_n(&malloc_initialized, true, __ATOMIC_RELEASE); -#endif #if !defined(MOZ_MEMORY_WINDOWS) && !defined(MOZ_MEMORY_DARWIN) /* Prevent potential deadlock on malloc locks after fork. */ -- cgit v1.2.3