diff options
Diffstat (limited to 'memory/mozjemalloc/jemalloc.c')
-rw-r--r-- | memory/mozjemalloc/jemalloc.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/memory/mozjemalloc/jemalloc.c b/memory/mozjemalloc/jemalloc.c index 8516658f5e..0cbd2821e2 100644 --- a/memory/mozjemalloc/jemalloc.c +++ b/memory/mozjemalloc/jemalloc.c @@ -140,17 +140,9 @@ #endif /* - * Use only one arena by default. Mozilla does not currently make extensive - * use of concurrent allocation, so the increased fragmentation associated with - * multiple arenas is not warranted. - * - * When using the Servo style system, we do indeed make use of significant - * concurrent allocation, and the overhead matters. Bug 1291355 tracks - * investigating the fragmentation overhead of turning this on for users. + * Uncomment this to use only one arena by default. */ -#ifndef MOZ_STYLO -#define MOZ_MEMORY_NARENAS_DEFAULT_ONE -#endif +// #define MOZ_MEMORY_NARENAS_DEFAULT_ONE /* * Pass this set of options to jemalloc as its default. It does not override @@ -5251,7 +5243,10 @@ huge_dalloc(void *ptr) base_node_dealloc(node); } -#ifndef MOZ_MEMORY_NARENAS_DEFAULT_ONE +/* + * Platform-specific methods to determine the number of CPUs in a system. + * This will be used to determine the desired number of arenas. + */ #ifdef MOZ_MEMORY_BSD static inline unsigned malloc_ncpus(void) @@ -5349,11 +5344,19 @@ malloc_ncpus(void) { return sysconf(_SC_NPROCESSORS_ONLN); } +#elif (defined(MOZ_MEMORY_WINDOWS)) +static inline unsigned +malloc_ncpus(void) +{ + SYSTEM_INFO info; + + GetSystemInfo(&info); + return (info.dwNumberOfProcessors); +} #else static inline unsigned malloc_ncpus(void) { - /* * We lack a way to determine the number of CPUs on this platform, so * assume 1 CPU. @@ -5361,7 +5364,6 @@ malloc_ncpus(void) return (1); } #endif -#endif static void malloc_print_stats(void) @@ -5562,20 +5564,16 @@ malloc_init_hard(void) GetSystemInfo(&info); result = info.dwPageSize; - -#ifndef MOZ_MEMORY_NARENAS_DEFAULT_ONE - ncpus = info.dwNumberOfProcessors; -#endif } #else -#ifndef MOZ_MEMORY_NARENAS_DEFAULT_ONE - ncpus = malloc_ncpus(); -#endif - result = sysconf(_SC_PAGESIZE); assert(result != -1); #endif +#ifndef MOZ_MEMORY_NARENAS_DEFAULT_ONE + ncpus = malloc_ncpus(); +#endif + /* We assume that the page size is a power of 2. */ assert(((result - 1) & result) == 0); #ifdef MALLOC_STATIC_SIZES |