Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/stdlib Switch to using TLS in old jemalloc for ever...
details: https://anonhg.NetBSD.org/src/rev/1aa90251155d
branches: trunk
changeset: 1009371:1aa90251155d
user: joerg <joerg%NetBSD.org@localhost>
date: Tue Apr 21 22:22:55 2020 +0000
description:
Switch to using TLS in old jemalloc for everywhere but VAX and sun2.
diffstat:
lib/libc/stdlib/jemalloc.c | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
diffs (106 lines):
diff -r 9d0a15c65e35 -r 1aa90251155d lib/libc/stdlib/jemalloc.c
--- a/lib/libc/stdlib/jemalloc.c Tue Apr 21 21:53:53 2020 +0000
+++ b/lib/libc/stdlib/jemalloc.c Tue Apr 21 22:22:55 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: jemalloc.c,v 1.48 2020/01/13 19:14:37 joerg Exp $ */
+/* $NetBSD: jemalloc.c,v 1.49 2020/04/21 22:22:55 joerg Exp $ */
/*-
* Copyright (C) 2006,2007 Jason Evans <jasone%FreeBSD.org@localhost>.
@@ -100,7 +100,6 @@
#ifdef __NetBSD__
# define xutrace(a, b) utrace("malloc", (a), (b))
# define __DECONST(x, y) ((x)__UNCONST(y))
-# define NO_TLS
#else
# define xutrace(a, b) utrace((a), (b))
#endif /* __NetBSD__ */
@@ -118,7 +117,7 @@
#include <sys/cdefs.h>
/* __FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.147 2007/06/15 22:00:16 jasone Exp $"); */
-__RCSID("$NetBSD: jemalloc.c,v 1.48 2020/01/13 19:14:37 joerg Exp $");
+__RCSID("$NetBSD: jemalloc.c,v 1.49 2020/04/21 22:22:55 joerg Exp $");
#ifdef __FreeBSD__
#include "libc_private.h"
@@ -222,13 +221,11 @@
# define QUANTUM_2POW_MIN 4
# define SIZEOF_PTR_2POW 3
# define TINY_MIN_2POW 3
-# define NO_TLS
#endif
#ifdef __sparc64__
# define QUANTUM_2POW_MIN 4
# define SIZEOF_PTR_2POW 3
# define TINY_MIN_2POW 3
-# define NO_TLS
#endif
#ifdef __amd64__
# define QUANTUM_2POW_MIN 4
@@ -242,7 +239,6 @@
# ifdef __ARM_EABI__
# define TINY_MIN_2POW 3
# endif
-# define NO_TLS
#endif
#ifdef __powerpc__
# define QUANTUM_2POW_MIN 4
@@ -264,6 +260,7 @@
# define QUANTUM_2POW_MIN 4
# define SIZEOF_PTR_2POW 2
# define USE_BRK
+# define NO_TLS
#endif
#ifdef __sh__
# define QUANTUM_2POW_MIN 4
@@ -274,6 +271,9 @@
# define QUANTUM_2POW_MIN 4
# define SIZEOF_PTR_2POW 2
# define USE_BRK
+# ifdef __mc68000__
+# define NO_TLS
+# endif
#endif
#if defined(__mips__) || defined(__riscv__)
# ifdef _LP64
@@ -771,9 +771,11 @@
* for allocations.
*/
#ifndef NO_TLS
-static __thread arena_t **arenas_map;
+static __attribute__((tls_model("initial-exec")))
+__thread arena_t **arenas_map;
#else
static arena_t **arenas_map;
+static thread_key_t arenas_map_key = -1;
#endif
#if !defined(NO_TLS) || !defined(_REENTRANT)
@@ -781,7 +783,6 @@
# define set_arenas_map(x) (arenas_map = x)
#else
-static thread_key_t arenas_map_key = -1;
static inline arena_t **
get_arenas_map(void)
@@ -809,14 +810,18 @@
}
if (arenas_map_key == -1) {
+#ifndef NO_TLS
(void)thr_keycreate(&arenas_map_key, NULL);
+#endif
if (arenas_map != NULL) {
_DIAGASSERT(arenas_map == a);
arenas_map = NULL;
}
}
+#ifndef NO_TLS
thr_setspecific(arenas_map_key, a);
+#endif
}
#endif
Home |
Main Index |
Thread Index |
Old Index