Title: [223950] trunk/Source/bmalloc
Revision
223950
Author
[email protected]
Date
2017-10-24 23:55:36 -0700 (Tue, 24 Oct 2017)

Log Message

[Linux] Enable Gigacage in x64 Linux environment
https://bugs.webkit.org/show_bug.cgi?id=177745
<rdar://problem/34773148>

Reviewed by Yusuke Suzuki.

Re-enable Gigacage on x86_64 Linux platforms after it was disabled in 223877.

The cause for the revert was problems with huge coredumps being generated
while Gigacage was enabled. The feature virtually allocates about 80GB of
memory at the beginning of the process lifetime. This is not a problem in
itself since the memory range is marked as not needed through madvise(),
but all this memory was still included upon core dump generation on Linux.
Since there are reasonable limits enforced upon core dumps, these were
being truncated every time, not yielding any useful information.

To avoid this, on Linux, invocations of madvise() with the MADV_NORMAL and
MADV_DONTNEED advice parameters should be accompanied with respectively
matching MADV_DODUMP and MADV_DONTDUMP madvise() calls. This correctly
avoids core-dumping any memory that's not yet been physically allocated.

* bmalloc/Gigacage.h:
* bmalloc/VMAllocate.h:
(bmalloc::vmDeallocatePhysicalPages):
(bmalloc::vmAllocatePhysicalPages):

Modified Paths

Diff

Modified: trunk/Source/bmalloc/ChangeLog (223949 => 223950)


--- trunk/Source/bmalloc/ChangeLog	2017-10-25 06:26:58 UTC (rev 223949)
+++ trunk/Source/bmalloc/ChangeLog	2017-10-25 06:55:36 UTC (rev 223950)
@@ -1,3 +1,31 @@
+2017-10-24  Zan Dobersek  <[email protected]>
+
+        [Linux] Enable Gigacage in x64 Linux environment
+        https://bugs.webkit.org/show_bug.cgi?id=177745
+        <rdar://problem/34773148>
+
+        Reviewed by Yusuke Suzuki.
+
+        Re-enable Gigacage on x86_64 Linux platforms after it was disabled in 223877.
+
+        The cause for the revert was problems with huge coredumps being generated
+        while Gigacage was enabled. The feature virtually allocates about 80GB of
+        memory at the beginning of the process lifetime. This is not a problem in
+        itself since the memory range is marked as not needed through madvise(),
+        but all this memory was still included upon core dump generation on Linux.
+        Since there are reasonable limits enforced upon core dumps, these were
+        being truncated every time, not yielding any useful information.
+
+        To avoid this, on Linux, invocations of madvise() with the MADV_NORMAL and
+        MADV_DONTNEED advice parameters should be accompanied with respectively
+        matching MADV_DODUMP and MADV_DONTDUMP madvise() calls. This correctly
+        avoids core-dumping any memory that's not yet been physically allocated.
+
+        * bmalloc/Gigacage.h:
+        * bmalloc/VMAllocate.h:
+        (bmalloc::vmDeallocatePhysicalPages):
+        (bmalloc::vmAllocatePhysicalPages):
+
 2017-10-24  David Kilzer  <[email protected]>
 
         Need to pass non-nil argument to SimulateCrash() in bmalloc::logVMFailure()

Modified: trunk/Source/bmalloc/bmalloc/Gigacage.h (223949 => 223950)


--- trunk/Source/bmalloc/bmalloc/Gigacage.h	2017-10-25 06:26:58 UTC (rev 223949)
+++ trunk/Source/bmalloc/bmalloc/Gigacage.h	2017-10-25 06:55:36 UTC (rev 223950)
@@ -52,7 +52,7 @@
 #define JSVALUE_GIGACAGE_MASK GIGACAGE_SIZE_TO_MASK(JSVALUE_GIGACAGE_SIZE)
 #define STRING_GIGACAGE_MASK GIGACAGE_SIZE_TO_MASK(STRING_GIGACAGE_SIZE)
 
-#if (BOS(DARWIN) && (BCPU(ARM64) || BCPU(X86_64)))
+#if (BOS(DARWIN) && (BCPU(ARM64) || BCPU(X86_64))) || (BOS(LINUX) && BCPU(X86_64))
 #define GIGACAGE_ENABLED 1
 #else
 #define GIGACAGE_ENABLED 0

Modified: trunk/Source/bmalloc/bmalloc/VMAllocate.h (223949 => 223950)


--- trunk/Source/bmalloc/bmalloc/VMAllocate.h	2017-10-25 06:26:58 UTC (rev 223949)
+++ trunk/Source/bmalloc/bmalloc/VMAllocate.h	2017-10-25 06:55:36 UTC (rev 223950)
@@ -193,7 +193,10 @@
     SYSCALL(madvise(p, vmSize, MADV_FREE_REUSABLE));
 #else
     SYSCALL(madvise(p, vmSize, MADV_DONTNEED));
+#if BOS(LINUX)
+    SYSCALL(madvise(p, vmSize, MADV_DONTDUMP));
 #endif
+#endif
 }
 
 inline void vmAllocatePhysicalPages(void* p, size_t vmSize)
@@ -203,7 +206,10 @@
     SYSCALL(madvise(p, vmSize, MADV_FREE_REUSE));
 #else
     SYSCALL(madvise(p, vmSize, MADV_NORMAL));
+#if BOS(LINUX)
+    SYSCALL(madvise(p, vmSize, MADV_DODUMP));
 #endif
+#endif
 }
 
 // Trims requests that are un-page-aligned.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to