Title: [167289] trunk/Source/bmalloc
Revision
167289
Author
[email protected]
Date
2014-04-14 19:44:09 -0700 (Mon, 14 Apr 2014)

Log Message

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.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/bmalloc/ChangeLog (167288 => 167289)


--- 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)
@@ -1,3 +1,46 @@
+2014-04-14  Geoffrey Garen  <[email protected]>
+
+        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.
+
 2014-04-14  Alexey Proskuryakov  <[email protected]>
 
         Fixed svn:ignore on bmalloc.xcodeproj, it had erroneous leading spaces.

Added: trunk/Source/bmalloc/bmalloc/BPlatform.h (0 => 167289)


--- trunk/Source/bmalloc/bmalloc/BPlatform.h	                        (rev 0)
+++ trunk/Source/bmalloc/bmalloc/BPlatform.h	2014-04-15 02:44:09 UTC (rev 167289)
@@ -0,0 +1,37 @@
+/*
+ * 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

Modified: trunk/Source/bmalloc/bmalloc/VMAllocate.h (167288 => 167289)


--- 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)
@@ -27,6 +27,7 @@
 #define VMAllocate_h
 
 #include "BAssert.h"
+#include "BPlatform.h"
 #include "Range.h"
 #include "Sizes.h"
 #include "Syscall.h"
@@ -38,8 +39,13 @@
 namespace bmalloc {
 
 #define BMALLOC_VM_TAG VM_MAKE_TAG(VM_MEMORY_TCMALLOC)
-    
-static const size_t vmPageSize = 16 * kB; // Least upper bound of the OS's we support.
+
+#if BPLATFORM(IOS)
+static const size_t vmPageSize = 16 * kB;
+#else
+static const size_t vmPageSize = 4 * kB;
+#endif
+
 static const size_t vmPageMask = ~(vmPageSize - 1);
     
 inline size_t vmSize(size_t size)

Modified: trunk/Source/bmalloc/bmalloc.xcodeproj/project.pbxproj (167288 => 167289)


--- 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)
@@ -13,6 +13,7 @@
 		1400274C18F89C3D00115C97 /* SegregatedFreeList.h in Headers */ = {isa = PBXBuildFile; fileRef = 146BEE1E18C841C50002D5A2 /* SegregatedFreeList.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1448C30018F3754600502839 /* mbmalloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1448C2FF18F3754300502839 /* mbmalloc.cpp */; };
 		1448C30118F3754C00502839 /* bmalloc.h in Headers */ = {isa = PBXBuildFile; fileRef = 1448C2FE18F3754300502839 /* bmalloc.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		14C919C918FCC59F0028DB43 /* BPlatform.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C919C818FCC59F0028DB43 /* BPlatform.h */; };
 		14CC394C18EA8858004AFE34 /* libbmalloc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14F271BE18EA3963008C152F /* libbmalloc.a */; };
 		14DD788C18F48CAE00950702 /* LargeChunk.h in Headers */ = {isa = PBXBuildFile; fileRef = 147AAA8818CD17CE002201E4 /* LargeChunk.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		14DD788D18F48CC600950702 /* BeginTag.h in Headers */ = {isa = PBXBuildFile; fileRef = 1417F64518B54A700076FA3F /* BeginTag.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -120,6 +121,7 @@
 		14B650C718F39F4800751968 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
 		14B650C818F39F4800751968 /* iOS.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = iOS.xcconfig; sourceTree = "<group>"; };
 		14B650C918F3A04200751968 /* mbmalloc.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = mbmalloc.xcconfig; sourceTree = "<group>"; };
+		14C919C818FCC59F0028DB43 /* BPlatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BPlatform.h; path = bmalloc/BPlatform.h; sourceTree = "<group>"; };
 		14CC394418EA8743004AFE34 /* libmbmalloc.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libmbmalloc.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
 		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; };
 		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; };
@@ -259,6 +261,7 @@
 				1421A87718EE462A00B4DD68 /* Algorithm.h */,
 				1417F65218BA88A00076FA3F /* AsyncTask.h */,
 				1413E468189EEDE400546D68 /* BAssert.h */,
+				14C919C818FCC59F0028DB43 /* BPlatform.h */,
 				14D9DB4517F2447100EAAB79 /* FixedVector.h */,
 				1413E460189DCE1E00546D68 /* Inline.h */,
 				144DCED817A728570093B2F2 /* Mutex.cpp */,
@@ -289,6 +292,7 @@
 			files = (
 				14DD78B518F48D6B00950702 /* Line.h in Headers */,
 				14DD78CF18F48D7500950702 /* Vector.h in Headers */,
+				14C919C918FCC59F0028DB43 /* BPlatform.h in Headers */,
 				14DD788C18F48CAE00950702 /* LargeChunk.h in Headers */,
 				14DD789218F48CFC00950702 /* EndTag.h in Headers */,
 				14DD78CC18F48D7500950702 /* PerThread.h in Headers */,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to