Bug 1100485 - Lock chunks during double purging to avoid racing with allocation. r=glandium
authorEmanuel Hoogeveen <emanuel.hoogeveen@gmail.com>
Wed, 19 Nov 2014 09:34:00 +0100
changeset 241230 5de035fe199af46f05f2a1a76470922bf9cb9f85
parent 241229 138da162366873a25cf1b9436b41114181d40243
child 241231 293af54d2872389ca9f3edd1995be91e9e4c14d3
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1100485
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1100485 - Lock chunks during double purging to avoid racing with allocation. r=glandium
memory/mozjemalloc/jemalloc.c
--- a/memory/mozjemalloc/jemalloc.c
+++ b/memory/mozjemalloc/jemalloc.c
@@ -6743,23 +6743,25 @@ jemalloc_purge_freed_pages_impl()
 {
 	size_t i;
 	for (i = 0; i < narenas; i++) {
 		arena_t *arena = arenas[i];
 		if (arena != NULL)
 			hard_purge_arena(arena);
 	}
 	if (!config_munmap || config_recycle) {
+		malloc_mutex_lock(&chunks_mtx);
 		extent_node_t *node = extent_tree_szad_first(&chunks_szad_mmap);
 		while (node) {
 			pages_decommit(node->addr, node->size);
 			pages_commit(node->addr, node->size);
 			node->zeroed = true;
 			node = extent_tree_szad_next(&chunks_szad_mmap, node);
 		}
+		malloc_mutex_unlock(&chunks_mtx);
 	}
 }
 
 #else /* !defined MALLOC_DOUBLE_PURGE */
 
 MOZ_JEMALLOC_API void
 jemalloc_purge_freed_pages_impl()
 {