Title: [86957] trunk/Source/_javascript_Core
Revision
86957
Author
[email protected]
Date
2011-05-20 08:55:16 -0700 (Fri, 20 May 2011)

Log Message

2011-05-20  Xan Lopez  <[email protected]>

        Reviewed by Oliver Hunt.

        JIT requires VM overcommit (particularly on x86-64), Linux does not by default support this without swap?
        https://bugs.webkit.org/show_bug.cgi?id=42756

        Use the MAP_NORESERVE flag for mmap on Linux to skip the kernel
        check of the available memory. This should give us an
        overcommit-like behavior in most systems, which is what we want.

        * wtf/OSAllocatorPosix.cpp:
        (WTF::OSAllocator::reserveAndCommit): pass MAP_NORSERVE to mmap.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (86956 => 86957)


--- trunk/Source/_javascript_Core/ChangeLog	2011-05-20 15:50:55 UTC (rev 86956)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-05-20 15:55:16 UTC (rev 86957)
@@ -1,3 +1,17 @@
+2011-05-20  Xan Lopez  <[email protected]>
+
+        Reviewed by Oliver Hunt.
+
+        JIT requires VM overcommit (particularly on x86-64), Linux does not by default support this without swap?
+        https://bugs.webkit.org/show_bug.cgi?id=42756
+
+        Use the MAP_NORESERVE flag for mmap on Linux to skip the kernel
+        check of the available memory. This should give us an
+        overcommit-like behavior in most systems, which is what we want.
+
+        * wtf/OSAllocatorPosix.cpp:
+        (WTF::OSAllocator::reserveAndCommit): pass MAP_NORSERVE to mmap.
+
 2011-05-19  Gabor Loki  <[email protected]>
 
         Fix ARM build after r86919

Modified: trunk/Source/_javascript_Core/wtf/OSAllocatorPosix.cpp (86956 => 86957)


--- trunk/Source/_javascript_Core/wtf/OSAllocatorPosix.cpp	2011-05-20 15:50:55 UTC (rev 86956)
+++ trunk/Source/_javascript_Core/wtf/OSAllocatorPosix.cpp	2011-05-20 15:55:16 UTC (rev 86957)
@@ -55,6 +55,18 @@
 
     int flags = MAP_PRIVATE | MAP_ANON;
 
+#if OS(LINUX)
+    // Linux distros usually do not allow overcommit by default, so
+    // JSC's strategy of mmaping a large amount of memory upfront
+    // won't work very well on some systems. Fortunately there's a
+    // flag we can pass to mmap to disable the overcommit check for
+    // this particular call, so we can get away with it as long as the
+    // overcommit flag value in /proc/sys/vm/overcommit_memory is 0
+    // ('heuristic') and not 2 (always check). 0 is the usual default
+    // value, so this should work well in general.
+    flags |= MAP_NORESERVE;
+#endif
+
 #if OS(DARWIN)
     int fd = usage;
 #else
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to