Changeset 86957 in webkit


Ignore:
Timestamp:
May 20, 2011 8:55:16 AM (13 years ago)
Author:
xan@webkit.org
Message:

2011-05-20 Xan Lopez <xlopez@igalia.com>

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.
Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r86923 r86957  
     12011-05-20  Xan Lopez  <xlopez@igalia.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        JIT requires VM overcommit (particularly on x86-64), Linux does not by default support this without swap?
     6        https://bugs.webkit.org/show_bug.cgi?id=42756
     7
     8        Use the MAP_NORESERVE flag for mmap on Linux to skip the kernel
     9        check of the available memory. This should give us an
     10        overcommit-like behavior in most systems, which is what we want.
     11
     12        * wtf/OSAllocatorPosix.cpp:
     13        (WTF::OSAllocator::reserveAndCommit): pass MAP_NORSERVE to mmap.
     14
    1152011-05-19  Gabor Loki  <loki@webkit.org>
    216
  • trunk/Source/JavaScriptCore/wtf/OSAllocatorPosix.cpp

    r86906 r86957  
    5555
    5656    int flags = MAP_PRIVATE | MAP_ANON;
     57
     58#if OS(LINUX)
     59    // Linux distros usually do not allow overcommit by default, so
     60    // JSC's strategy of mmaping a large amount of memory upfront
     61    // won't work very well on some systems. Fortunately there's a
     62    // flag we can pass to mmap to disable the overcommit check for
     63    // this particular call, so we can get away with it as long as the
     64    // overcommit flag value in /proc/sys/vm/overcommit_memory is 0
     65    // ('heuristic') and not 2 (always check). 0 is the usual default
     66    // value, so this should work well in general.
     67    flags |= MAP_NORESERVE;
     68#endif
    5769
    5870#if OS(DARWIN)
Note: See TracChangeset for help on using the changeset viewer.