<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[167289] trunk/Source/bmalloc</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/167289">167289</a></dd>
<dt>Author</dt> <dd>ggaren@apple.com</dd>
<dt>Date</dt> <dd>2014-04-14 19:44:09 -0700 (Mon, 14 Apr 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Use 4kB pages on Mac
https://bugs.webkit.org/show_bug.cgi?id=131658
Reviewed by Sam Weinig.
This reduces memory use a lot on Membuster:
base patch Δ
Execution Time:
reddit_memory_warning 18ms 17ms ^ 1.06x faster
flickr_memory_warning 34ms 36ms ! 1.06x slower
theverge_memory_warning 39ms 41ms ! 1.05x slower
<geometric mean> 29ms 29ms ! 1.02x slower
<arithmetic mean> 30ms 31ms ! 1.03x slower
<harmonic mean> 27ms 27ms ^ 1.0x faster
Peak Memory:
reddit_memory_warning 16,412kB 16,436kB ! 1.0x bigger
flickr_memory_warning 30,120kB 30,184kB ! 1.0x bigger
theverge_memory_warning 33,408kB 33,420kB ! 1.0x bigger
<geometric mean> 25,466kB 25,499kB ! 1.0x bigger
<arithmetic mean> 26,647kB 26,680kB ! 1.0x bigger
<harmonic mean> 24,181kB 24,214kB ! 1.0x bigger
Memory at End:
reddit_memory_warning 2,404kB 1,920kB ^ 1.25x smaller
flickr_memory_warning 3,764kB 3,072kB ^ 1.23x smaller
theverge_memory_warning 3,648kB 3,132kB ^ 1.16x smaller
<geometric mean> 3,208kB 2,644kB ^ 1.21x smaller
<arithmetic mean> 3,272kB 2,708kB ^ 1.21x smaller
<harmonic mean> 3,139kB 2,574kB ^ 1.22x smaller
* bmalloc.xcodeproj/project.pbxproj:
* bmalloc/BPlatform.h: Added.
* bmalloc/VMAllocate.h: Only use 16kB pages on iOS because the page size
is 4kB on Mac.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourcebmallocChangeLog">trunk/Source/bmalloc/ChangeLog</a></li>
<li><a href="#trunkSourcebmallocbmallocVMAllocateh">trunk/Source/bmalloc/bmalloc/VMAllocate.h</a></li>
<li><a href="#trunkSourcebmallocbmallocxcodeprojprojectpbxproj">trunk/Source/bmalloc/bmalloc.xcodeproj/project.pbxproj</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourcebmallocbmallocBPlatformh">trunk/Source/bmalloc/bmalloc/BPlatform.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourcebmallocChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/bmalloc/ChangeLog (167288 => 167289)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/bmalloc/ChangeLog        2014-04-15 02:20:17 UTC (rev 167288)
+++ trunk/Source/bmalloc/ChangeLog        2014-04-15 02:44:09 UTC (rev 167289)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2014-04-14 Geoffrey Garen <ggaren@apple.com>
+
+ Use 4kB pages on Mac
+ https://bugs.webkit.org/show_bug.cgi?id=131658
+
+ Reviewed by Sam Weinig.
+
+ This reduces memory use a lot on Membuster:
+
+ base patch Δ
+ Execution Time:
+ reddit_memory_warning 18ms 17ms ^ 1.06x faster
+ flickr_memory_warning 34ms 36ms ! 1.06x slower
+ theverge_memory_warning 39ms 41ms ! 1.05x slower
+
+ <geometric mean> 29ms 29ms ! 1.02x slower
+ <arithmetic mean> 30ms 31ms ! 1.03x slower
+ <harmonic mean> 27ms 27ms ^ 1.0x faster
+
+ Peak Memory:
+ reddit_memory_warning 16,412kB 16,436kB ! 1.0x bigger
+ flickr_memory_warning 30,120kB 30,184kB ! 1.0x bigger
+ theverge_memory_warning 33,408kB 33,420kB ! 1.0x bigger
+
+ <geometric mean> 25,466kB 25,499kB ! 1.0x bigger
+ <arithmetic mean> 26,647kB 26,680kB ! 1.0x bigger
+ <harmonic mean> 24,181kB 24,214kB ! 1.0x bigger
+
+ Memory at End:
+ reddit_memory_warning 2,404kB 1,920kB ^ 1.25x smaller
+ flickr_memory_warning 3,764kB 3,072kB ^ 1.23x smaller
+ theverge_memory_warning 3,648kB 3,132kB ^ 1.16x smaller
+
+ <geometric mean> 3,208kB 2,644kB ^ 1.21x smaller
+ <arithmetic mean> 3,272kB 2,708kB ^ 1.21x smaller
+ <harmonic mean> 3,139kB 2,574kB ^ 1.22x smaller
+
+
+ * bmalloc.xcodeproj/project.pbxproj:
+ * bmalloc/BPlatform.h: Added.
+ * bmalloc/VMAllocate.h: Only use 16kB pages on iOS because the page size
+ is 4kB on Mac.
+
</ins><span class="cx"> 2014-04-14 Alexey Proskuryakov <ap@apple.com>
</span><span class="cx">
</span><span class="cx"> Fixed svn:ignore on bmalloc.xcodeproj, it had erroneous leading spaces.
</span></span></pre></div>
<a id="trunkSourcebmallocbmallocBPlatformh"></a>
<div class="addfile"><h4>Added: trunk/Source/bmalloc/bmalloc/BPlatform.h (0 => 167289)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/bmalloc/bmalloc/BPlatform.h         (rev 0)
+++ trunk/Source/bmalloc/bmalloc/BPlatform.h        2014-04-15 02:44:09 UTC (rev 167289)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BPlatform_h
+#define BPlatform_h
+
+#define BPLATFORM(PLATFORM) (defined BPLATFORM_##PLATFORM && PLATFORM_##PLATFORM)
+
+#if ((defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) \
+ || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) \
+ || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR))
+#define BPLATFORM_IOS 1
+#endif
+
+#endif // BPlatform_h
</ins></span></pre></div>
<a id="trunkSourcebmallocbmallocVMAllocateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/bmalloc/bmalloc/VMAllocate.h (167288 => 167289)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/bmalloc/bmalloc/VMAllocate.h        2014-04-15 02:20:17 UTC (rev 167288)
+++ trunk/Source/bmalloc/bmalloc/VMAllocate.h        2014-04-15 02:44:09 UTC (rev 167289)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #define VMAllocate_h
</span><span class="cx">
</span><span class="cx"> #include "BAssert.h"
</span><ins>+#include "BPlatform.h"
</ins><span class="cx"> #include "Range.h"
</span><span class="cx"> #include "Sizes.h"
</span><span class="cx"> #include "Syscall.h"
</span><span class="lines">@@ -38,8 +39,13 @@
</span><span class="cx"> namespace bmalloc {
</span><span class="cx">
</span><span class="cx"> #define BMALLOC_VM_TAG VM_MAKE_TAG(VM_MEMORY_TCMALLOC)
</span><del>-
-static const size_t vmPageSize = 16 * kB; // Least upper bound of the OS's we support.
</del><ins>+
+#if BPLATFORM(IOS)
+static const size_t vmPageSize = 16 * kB;
+#else
+static const size_t vmPageSize = 4 * kB;
+#endif
+
</ins><span class="cx"> static const size_t vmPageMask = ~(vmPageSize - 1);
</span><span class="cx">
</span><span class="cx"> inline size_t vmSize(size_t size)
</span></span></pre></div>
<a id="trunkSourcebmallocbmallocxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/bmalloc/bmalloc.xcodeproj/project.pbxproj (167288 => 167289)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/bmalloc/bmalloc.xcodeproj/project.pbxproj        2014-04-15 02:20:17 UTC (rev 167288)
+++ trunk/Source/bmalloc/bmalloc.xcodeproj/project.pbxproj        2014-04-15 02:44:09 UTC (rev 167289)
</span><span class="lines">@@ -13,6 +13,7 @@
</span><span class="cx">                 1400274C18F89C3D00115C97 /* SegregatedFreeList.h in Headers */ = {isa = PBXBuildFile; fileRef = 146BEE1E18C841C50002D5A2 /* SegregatedFreeList.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 1448C30018F3754600502839 /* mbmalloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1448C2FF18F3754300502839 /* mbmalloc.cpp */; };
</span><span class="cx">                 1448C30118F3754C00502839 /* bmalloc.h in Headers */ = {isa = PBXBuildFile; fileRef = 1448C2FE18F3754300502839 /* bmalloc.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                14C919C918FCC59F0028DB43 /* BPlatform.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C919C818FCC59F0028DB43 /* BPlatform.h */; };
</ins><span class="cx">                 14CC394C18EA8858004AFE34 /* libbmalloc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14F271BE18EA3963008C152F /* libbmalloc.a */; };
</span><span class="cx">                 14DD788C18F48CAE00950702 /* LargeChunk.h in Headers */ = {isa = PBXBuildFile; fileRef = 147AAA8818CD17CE002201E4 /* LargeChunk.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 14DD788D18F48CC600950702 /* BeginTag.h in Headers */ = {isa = PBXBuildFile; fileRef = 1417F64518B54A700076FA3F /* BeginTag.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -120,6 +121,7 @@
</span><span class="cx">                 14B650C718F39F4800751968 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
</span><span class="cx">                 14B650C818F39F4800751968 /* iOS.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = iOS.xcconfig; sourceTree = "<group>"; };
</span><span class="cx">                 14B650C918F3A04200751968 /* mbmalloc.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = mbmalloc.xcconfig; sourceTree = "<group>"; };
</span><ins>+                14C919C818FCC59F0028DB43 /* BPlatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BPlatform.h; path = bmalloc/BPlatform.h; sourceTree = "<group>"; };
</ins><span class="cx">                 14CC394418EA8743004AFE34 /* libmbmalloc.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libmbmalloc.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
</span><span class="cx">                 14D9DB4517F2447100EAAB79 /* FixedVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = FixedVector.h; path = bmalloc/FixedVector.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
</span><span class="cx">                 14DA32071885F9E6007269E0 /* Line.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = Line.h; path = bmalloc/Line.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
</span><span class="lines">@@ -259,6 +261,7 @@
</span><span class="cx">                                 1421A87718EE462A00B4DD68 /* Algorithm.h */,
</span><span class="cx">                                 1417F65218BA88A00076FA3F /* AsyncTask.h */,
</span><span class="cx">                                 1413E468189EEDE400546D68 /* BAssert.h */,
</span><ins>+                                14C919C818FCC59F0028DB43 /* BPlatform.h */,
</ins><span class="cx">                                 14D9DB4517F2447100EAAB79 /* FixedVector.h */,
</span><span class="cx">                                 1413E460189DCE1E00546D68 /* Inline.h */,
</span><span class="cx">                                 144DCED817A728570093B2F2 /* Mutex.cpp */,
</span><span class="lines">@@ -289,6 +292,7 @@
</span><span class="cx">                         files = (
</span><span class="cx">                                 14DD78B518F48D6B00950702 /* Line.h in Headers */,
</span><span class="cx">                                 14DD78CF18F48D7500950702 /* Vector.h in Headers */,
</span><ins>+                                14C919C918FCC59F0028DB43 /* BPlatform.h in Headers */,
</ins><span class="cx">                                 14DD788C18F48CAE00950702 /* LargeChunk.h in Headers */,
</span><span class="cx">                                 14DD789218F48CFC00950702 /* EndTag.h in Headers */,
</span><span class="cx">                                 14DD78CC18F48D7500950702 /* PerThread.h in Headers */,
</span></span></pre>
</div>
</div>
</body>
</html>