From owner-freebsd-gecko@FreeBSD.ORG Wed Nov 19 01:27:39 2014 Return-Path: Delivered-To: freebsd-gecko@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 80BB662A for ; Wed, 19 Nov 2014 01:27:39 +0000 (UTC) Received: from trillian.chruetertee.ch (trillian.chruetertee.ch [217.150.244.247]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D468FDF for ; Wed, 19 Nov 2014 01:27:38 +0000 (UTC) Received: from trillian.chruetertee.ch (trillian [217.150.244.247]) by trillian.chruetertee.ch (8.14.4/8.14.3) with ESMTP id sAJ1RTSj013131 for ; Wed, 19 Nov 2014 01:27:29 GMT (envelope-from svn-freebsd-gecko@chruetertee.ch) Received: (from www@localhost) by trillian.chruetertee.ch (8.14.4/8.14.3/Submit) id sAJ1ROUP011079 for freebsd-gecko@freebsd.org; Wed, 19 Nov 2014 01:27:24 GMT (envelope-from svn-freebsd-gecko@chruetertee.ch) Date: Wed, 19 Nov 2014 01:27:24 GMT Message-Id: <201411190127.sAJ1ROUP011079@trillian.chruetertee.ch> X-Authentication-Warning: trillian.chruetertee.ch: www set sender to svn-freebsd-gecko@chruetertee.ch using -f From: svn-freebsd-gecko@chruetertee.ch To: freebsd-gecko@freebsd.org Subject: [SVN-Commit] r1763 - in trunk: mail/thunderbird/files www/firefox-esr/files www/firefox-nightly/files www/firefox/files www/libxul/files www/seamonkey/files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reply-To: freebsd-gecko@freebsd.org X-BeenThere: freebsd-gecko@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Gecko Rendering Engine issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2014 01:27:39 -0000 Author: jbeich Date: Wed Nov 19 01:27:24 2014 New Revision: 1763 Log: add a few about:memory fixes Added: trunk/mail/thunderbird/files/patch-bug1082199 trunk/www/firefox-esr/files/patch-bug1082199 trunk/www/firefox-nightly/files/patch-bug899126 trunk/www/firefox/files/patch-bug1082199 trunk/www/firefox/files/patch-bug899126 trunk/www/libxul/files/patch-bug1082199 trunk/www/seamonkey/files/patch-bug1082199 trunk/www/seamonkey/files/patch-bug899126 Added: trunk/mail/thunderbird/files/patch-bug1082199 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/mail/thunderbird/files/patch-bug1082199 Wed Nov 19 01:27:24 2014 (r1763) @@ -0,0 +1,26 @@ +commit 258ec90 +Author: Guilherme Goncalves +Date: Fri Oct 17 15:55:00 2014 +0200 + + Bug 1082199 - Recompute stats in jemalloc_stats when using jemalloc3. r=glandium +--- + memory/build/mozjemalloc_compat.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git memory/build/mozjemalloc_compat.c memory/build/mozjemalloc_compat.c +index 78bb13a..70265a7 100644 +--- mozilla/memory/build/mozjemalloc_compat.c ++++ mozilla/memory/build/mozjemalloc_compat.c +@@ -68,6 +68,12 @@ jemalloc_stats_impl(jemalloc_stats_t *stats) + size_t active, allocated, mapped, page, pdirty; + size_t lg_chunk; + ++ // Refresh jemalloc's stats by updating its epoch, see ctl_refresh in ++ // src/ctl.c ++ uint64_t epoch = 0; ++ size_t esz = sizeof(epoch); ++ int ret = je_(mallctl)("epoch", &epoch, &esz, &epoch, esz); ++ + CTL_GET("arenas.narenas", narenas); + CTL_GET("arenas.page", page); + CTL_GET("stats.active", active); Added: trunk/www/firefox-esr/files/patch-bug1082199 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/www/firefox-esr/files/patch-bug1082199 Wed Nov 19 01:27:24 2014 (r1763) @@ -0,0 +1,26 @@ +commit 258ec90 +Author: Guilherme Goncalves +Date: Fri Oct 17 15:55:00 2014 +0200 + + Bug 1082199 - Recompute stats in jemalloc_stats when using jemalloc3. r=glandium +--- + memory/build/mozjemalloc_compat.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git memory/build/mozjemalloc_compat.c memory/build/mozjemalloc_compat.c +index 78bb13a..70265a7 100644 +--- memory/build/mozjemalloc_compat.c ++++ memory/build/mozjemalloc_compat.c +@@ -68,6 +68,12 @@ jemalloc_stats_impl(jemalloc_stats_t *stats) + size_t active, allocated, mapped, page, pdirty; + size_t lg_chunk; + ++ // Refresh jemalloc's stats by updating its epoch, see ctl_refresh in ++ // src/ctl.c ++ uint64_t epoch = 0; ++ size_t esz = sizeof(epoch); ++ int ret = je_(mallctl)("epoch", &epoch, &esz, &epoch, esz); ++ + CTL_GET("arenas.narenas", narenas); + CTL_GET("arenas.page", page); + CTL_GET("stats.active", active); Added: trunk/www/firefox-nightly/files/patch-bug899126 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/www/firefox-nightly/files/patch-bug899126 Wed Nov 19 01:27:24 2014 (r1763) @@ -0,0 +1,98 @@ +commit 0f63381 +Author: Guilherme Goncalves +Date: Tue Nov 18 14:03:00 2014 -0800 + + Bug 899126 - Part 1 - Implement bin_unused for jemalloc3. r=glandium +--- + memory/build/mozjemalloc_compat.c | 57 ++++++++++++++++++++++++++++++++++++++- + 1 file changed, 56 insertions(+), 1 deletion(-) + +diff --git memory/build/mozjemalloc_compat.c memory/build/mozjemalloc_compat.c +index 70265a7..0a9b21a 100644 +--- memory/build/mozjemalloc_compat.c ++++ memory/build/mozjemalloc_compat.c +@@ -12,6 +12,8 @@ + #include "jemalloc_types.h" + #include "mozilla/Types.h" + ++#include ++ + #if defined(MOZ_NATIVE_JEMALLOC) + + MOZ_IMPORT_API int +@@ -47,6 +49,16 @@ je_(nallocm)(size_t *rsize, size_t size, int flags); + je_(mallctlbymib)(mib, miblen, &v, &sz, NULL, 0); \ + } while (0) + ++#define CTL_IJ_GET(n, v, i, j) do { \ ++ size_t mib[6]; \ ++ size_t miblen = sizeof(mib) / sizeof(mib[0]); \ ++ size_t sz = sizeof(v); \ ++ je_(mallctlnametomib)(n, mib, &miblen); \ ++ mib[2] = i; \ ++ mib[4] = j; \ ++ je_(mallctlbymib)(mib, miblen, &v, &sz, NULL, 0); \ ++} while (0) ++ + MOZ_MEMORY_API size_t + malloc_good_size_impl(size_t size) + { +@@ -61,6 +73,48 @@ malloc_good_size_impl(size_t size) + return size; + } + ++static size_t ++compute_bin_unused(unsigned int narenas) ++{ ++ size_t bin_unused = 0; ++ ++ uint32_t nregs; // number of regions per run in the j-th bin ++ size_t reg_size; // size of regions served by the j-th bin ++ size_t curruns; // number of runs belonging to a bin ++ size_t curregs; // number of allocated regions in a bin ++ ++ unsigned int nbins; // number of bins per arena ++ unsigned int i, j; ++ ++ // curruns and curregs are not defined for uninitialized arenas, ++ // so we skip them when computing bin_unused. However, initialized ++ // arenas are not guaranteed to be sequential, so we must test each ++ // one when iterating below. ++ bool initialized[100]; // should be narenas, but MSVC doesn't have VLAs ++ size_t isz = sizeof(initialized) / sizeof(initialized[0]); ++ ++ je_(mallctl)("arenas.initialized", initialized, &isz, NULL, 0); ++ CTL_GET("arenas.nbins", nbins); ++ ++ for (j = 0; j < nbins; j++) { ++ CTL_I_GET("arenas.bin.0.nregs", nregs, j); ++ CTL_I_GET("arenas.bin.0.size", reg_size, j); ++ ++ for (i = 0; i < narenas; i++) { ++ if (!initialized[i]) { ++ continue; ++ } ++ ++ CTL_IJ_GET("stats.arenas.0.bins.0.curruns", curruns, i, j); ++ CTL_IJ_GET("stats.arenas.0.bins.0.curregs", curregs, i, j); ++ ++ bin_unused += (nregs * curruns - curregs) * reg_size; ++ } ++ } ++ ++ return bin_unused; ++} ++ + MOZ_JEMALLOC_API void + jemalloc_stats_impl(jemalloc_stats_t *stats) + { +@@ -93,7 +147,8 @@ jemalloc_stats_impl(jemalloc_stats_t *stats) + // We could get this value out of base.c::base_pages, but that really should + // be an upstream change, so don't worry about it for now. + stats->bookkeeping = 0; +- stats->bin_unused = 0; ++ ++ stats->bin_unused = compute_bin_unused(narenas); + } + + MOZ_JEMALLOC_API void Added: trunk/www/firefox/files/patch-bug1082199 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/www/firefox/files/patch-bug1082199 Wed Nov 19 01:27:24 2014 (r1763) @@ -0,0 +1,26 @@ +commit 258ec90 +Author: Guilherme Goncalves +Date: Fri Oct 17 15:55:00 2014 +0200 + + Bug 1082199 - Recompute stats in jemalloc_stats when using jemalloc3. r=glandium +--- + memory/build/mozjemalloc_compat.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git memory/build/mozjemalloc_compat.c memory/build/mozjemalloc_compat.c +index 78bb13a..70265a7 100644 +--- memory/build/mozjemalloc_compat.c ++++ memory/build/mozjemalloc_compat.c +@@ -68,6 +68,12 @@ jemalloc_stats_impl(jemalloc_stats_t *stats) + size_t active, allocated, mapped, page, pdirty; + size_t lg_chunk; + ++ // Refresh jemalloc's stats by updating its epoch, see ctl_refresh in ++ // src/ctl.c ++ uint64_t epoch = 0; ++ size_t esz = sizeof(epoch); ++ int ret = je_(mallctl)("epoch", &epoch, &esz, &epoch, esz); ++ + CTL_GET("arenas.narenas", narenas); + CTL_GET("arenas.page", page); + CTL_GET("stats.active", active); Added: trunk/www/firefox/files/patch-bug899126 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/www/firefox/files/patch-bug899126 Wed Nov 19 01:27:24 2014 (r1763) @@ -0,0 +1,98 @@ +commit 0f63381 +Author: Guilherme Goncalves +Date: Tue Nov 18 14:03:00 2014 -0800 + + Bug 899126 - Part 1 - Implement bin_unused for jemalloc3. r=glandium +--- + memory/build/mozjemalloc_compat.c | 57 ++++++++++++++++++++++++++++++++++++++- + 1 file changed, 56 insertions(+), 1 deletion(-) + +diff --git memory/build/mozjemalloc_compat.c memory/build/mozjemalloc_compat.c +index 70265a7..0a9b21a 100644 +--- memory/build/mozjemalloc_compat.c ++++ memory/build/mozjemalloc_compat.c +@@ -12,6 +12,8 @@ + #include "jemalloc_types.h" + #include "mozilla/Types.h" + ++#include ++ + #if defined(MOZ_NATIVE_JEMALLOC) + + MOZ_IMPORT_API int +@@ -47,6 +49,16 @@ je_(nallocm)(size_t *rsize, size_t size, int flags); + je_(mallctlbymib)(mib, miblen, &v, &sz, NULL, 0); \ + } while (0) + ++#define CTL_IJ_GET(n, v, i, j) do { \ ++ size_t mib[6]; \ ++ size_t miblen = sizeof(mib) / sizeof(mib[0]); \ ++ size_t sz = sizeof(v); \ ++ je_(mallctlnametomib)(n, mib, &miblen); \ ++ mib[2] = i; \ ++ mib[4] = j; \ ++ je_(mallctlbymib)(mib, miblen, &v, &sz, NULL, 0); \ ++} while (0) ++ + MOZ_MEMORY_API size_t + malloc_good_size_impl(size_t size) + { +@@ -61,6 +73,48 @@ malloc_good_size_impl(size_t size) + return size; + } + ++static size_t ++compute_bin_unused(unsigned int narenas) ++{ ++ size_t bin_unused = 0; ++ ++ uint32_t nregs; // number of regions per run in the j-th bin ++ size_t reg_size; // size of regions served by the j-th bin ++ size_t curruns; // number of runs belonging to a bin ++ size_t curregs; // number of allocated regions in a bin ++ ++ unsigned int nbins; // number of bins per arena ++ unsigned int i, j; ++ ++ // curruns and curregs are not defined for uninitialized arenas, ++ // so we skip them when computing bin_unused. However, initialized ++ // arenas are not guaranteed to be sequential, so we must test each ++ // one when iterating below. ++ bool initialized[100]; // should be narenas, but MSVC doesn't have VLAs ++ size_t isz = sizeof(initialized) / sizeof(initialized[0]); ++ ++ je_(mallctl)("arenas.initialized", initialized, &isz, NULL, 0); ++ CTL_GET("arenas.nbins", nbins); ++ ++ for (j = 0; j < nbins; j++) { ++ CTL_I_GET("arenas.bin.0.nregs", nregs, j); ++ CTL_I_GET("arenas.bin.0.size", reg_size, j); ++ ++ for (i = 0; i < narenas; i++) { ++ if (!initialized[i]) { ++ continue; ++ } ++ ++ CTL_IJ_GET("stats.arenas.0.bins.0.curruns", curruns, i, j); ++ CTL_IJ_GET("stats.arenas.0.bins.0.curregs", curregs, i, j); ++ ++ bin_unused += (nregs * curruns - curregs) * reg_size; ++ } ++ } ++ ++ return bin_unused; ++} ++ + MOZ_JEMALLOC_API void + jemalloc_stats_impl(jemalloc_stats_t *stats) + { +@@ -93,7 +147,8 @@ jemalloc_stats_impl(jemalloc_stats_t *stats) + // We could get this value out of base.c::base_pages, but that really should + // be an upstream change, so don't worry about it for now. + stats->bookkeeping = 0; +- stats->bin_unused = 0; ++ ++ stats->bin_unused = compute_bin_unused(narenas); + } + + MOZ_JEMALLOC_API void Added: trunk/www/libxul/files/patch-bug1082199 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/www/libxul/files/patch-bug1082199 Wed Nov 19 01:27:24 2014 (r1763) @@ -0,0 +1,26 @@ +commit 258ec90 +Author: Guilherme Goncalves +Date: Fri Oct 17 15:55:00 2014 +0200 + + Bug 1082199 - Recompute stats in jemalloc_stats when using jemalloc3. r=glandium +--- + memory/build/mozjemalloc_compat.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git memory/build/mozjemalloc_compat.c memory/build/mozjemalloc_compat.c +index 78bb13a..70265a7 100644 +--- memory/build/mozjemalloc_compat.c ++++ memory/build/mozjemalloc_compat.c +@@ -68,6 +68,12 @@ jemalloc_stats_impl(jemalloc_stats_t *stats) + size_t active, allocated, mapped, page, pdirty; + size_t lg_chunk; + ++ // Refresh jemalloc's stats by updating its epoch, see ctl_refresh in ++ // src/ctl.c ++ uint64_t epoch = 0; ++ size_t esz = sizeof(epoch); ++ int ret = je_(mallctl)("epoch", &epoch, &esz, &epoch, esz); ++ + CTL_GET("arenas.narenas", narenas); + CTL_GET("arenas.page", page); + CTL_GET("stats.active", active); Added: trunk/www/seamonkey/files/patch-bug1082199 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/www/seamonkey/files/patch-bug1082199 Wed Nov 19 01:27:24 2014 (r1763) @@ -0,0 +1,26 @@ +commit 258ec90 +Author: Guilherme Goncalves +Date: Fri Oct 17 15:55:00 2014 +0200 + + Bug 1082199 - Recompute stats in jemalloc_stats when using jemalloc3. r=glandium +--- + memory/build/mozjemalloc_compat.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git memory/build/mozjemalloc_compat.c memory/build/mozjemalloc_compat.c +index 78bb13a..70265a7 100644 +--- mozilla/memory/build/mozjemalloc_compat.c ++++ mozilla/memory/build/mozjemalloc_compat.c +@@ -68,6 +68,12 @@ jemalloc_stats_impl(jemalloc_stats_t *stats) + size_t active, allocated, mapped, page, pdirty; + size_t lg_chunk; + ++ // Refresh jemalloc's stats by updating its epoch, see ctl_refresh in ++ // src/ctl.c ++ uint64_t epoch = 0; ++ size_t esz = sizeof(epoch); ++ int ret = je_(mallctl)("epoch", &epoch, &esz, &epoch, esz); ++ + CTL_GET("arenas.narenas", narenas); + CTL_GET("arenas.page", page); + CTL_GET("stats.active", active); Added: trunk/www/seamonkey/files/patch-bug899126 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/www/seamonkey/files/patch-bug899126 Wed Nov 19 01:27:24 2014 (r1763) @@ -0,0 +1,98 @@ +commit 0f63381 +Author: Guilherme Goncalves +Date: Tue Nov 18 14:03:00 2014 -0800 + + Bug 899126 - Part 1 - Implement bin_unused for jemalloc3. r=glandium +--- + memory/build/mozjemalloc_compat.c | 57 ++++++++++++++++++++++++++++++++++++++- + 1 file changed, 56 insertions(+), 1 deletion(-) + +diff --git memory/build/mozjemalloc_compat.c memory/build/mozjemalloc_compat.c +index 70265a7..0a9b21a 100644 +--- mozilla/memory/build/mozjemalloc_compat.c ++++ mozilla/memory/build/mozjemalloc_compat.c +@@ -12,6 +12,8 @@ + #include "jemalloc_types.h" + #include "mozilla/Types.h" + ++#include ++ + #if defined(MOZ_NATIVE_JEMALLOC) + + MOZ_IMPORT_API int +@@ -47,6 +49,16 @@ je_(nallocm)(size_t *rsize, size_t size, int flags); + je_(mallctlbymib)(mib, miblen, &v, &sz, NULL, 0); \ + } while (0) + ++#define CTL_IJ_GET(n, v, i, j) do { \ ++ size_t mib[6]; \ ++ size_t miblen = sizeof(mib) / sizeof(mib[0]); \ ++ size_t sz = sizeof(v); \ ++ je_(mallctlnametomib)(n, mib, &miblen); \ ++ mib[2] = i; \ ++ mib[4] = j; \ ++ je_(mallctlbymib)(mib, miblen, &v, &sz, NULL, 0); \ ++} while (0) ++ + MOZ_MEMORY_API size_t + malloc_good_size_impl(size_t size) + { +@@ -61,6 +73,48 @@ malloc_good_size_impl(size_t size) + return size; + } + ++static size_t ++compute_bin_unused(unsigned int narenas) ++{ ++ size_t bin_unused = 0; ++ ++ uint32_t nregs; // number of regions per run in the j-th bin ++ size_t reg_size; // size of regions served by the j-th bin ++ size_t curruns; // number of runs belonging to a bin ++ size_t curregs; // number of allocated regions in a bin ++ ++ unsigned int nbins; // number of bins per arena ++ unsigned int i, j; ++ ++ // curruns and curregs are not defined for uninitialized arenas, ++ // so we skip them when computing bin_unused. However, initialized ++ // arenas are not guaranteed to be sequential, so we must test each ++ // one when iterating below. ++ bool initialized[100]; // should be narenas, but MSVC doesn't have VLAs ++ size_t isz = sizeof(initialized) / sizeof(initialized[0]); ++ ++ je_(mallctl)("arenas.initialized", initialized, &isz, NULL, 0); ++ CTL_GET("arenas.nbins", nbins); ++ ++ for (j = 0; j < nbins; j++) { ++ CTL_I_GET("arenas.bin.0.nregs", nregs, j); ++ CTL_I_GET("arenas.bin.0.size", reg_size, j); ++ ++ for (i = 0; i < narenas; i++) { ++ if (!initialized[i]) { ++ continue; ++ } ++ ++ CTL_IJ_GET("stats.arenas.0.bins.0.curruns", curruns, i, j); ++ CTL_IJ_GET("stats.arenas.0.bins.0.curregs", curregs, i, j); ++ ++ bin_unused += (nregs * curruns - curregs) * reg_size; ++ } ++ } ++ ++ return bin_unused; ++} ++ + MOZ_JEMALLOC_API void + jemalloc_stats_impl(jemalloc_stats_t *stats) + { +@@ -93,7 +147,8 @@ jemalloc_stats_impl(jemalloc_stats_t *stats) + // We could get this value out of base.c::base_pages, but that really should + // be an upstream change, so don't worry about it for now. + stats->bookkeeping = 0; +- stats->bin_unused = 0; ++ ++ stats->bin_unused = compute_bin_unused(narenas); + } + + MOZ_JEMALLOC_API void