Changeset 207252 in webkit


Ignore:
Timestamp:
Oct 12, 2016 4:01:50 PM (7 years ago)
Author:
matthew_hanson@apple.com
Message:

Merge r204091. rdar://problem/28476960

Location:
branches/safari-602.2.14.0-branch/Source/bmalloc
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-602.2.14.0-branch/Source/bmalloc/ChangeLog

    r203169 r207252  
     12016-10-12  Matthew Hanson  <matthew_hanson@apple.com>
     2
     3        Merge r204091. rdar://problem/28476960
     4
     5    2016-08-03  Geoffrey Garen  <ggaren@apple.com>
     6
     7            [bmalloc] Merging of XLargeRanges can leak the upper range
     8            https://bugs.webkit.org/show_bug.cgi?id=160403
     9
     10            Reviewed by Michael Saboff.
     11
     12            * bmalloc/Heap.cpp:
     13            (bmalloc::Heap::scavengeLargeObjects): Don't use removePhysical().
     14            Recorded physical size is a performance optimization. It is not the
     15            truth. So it might be zero even if a range contains physical pages.
     16
     17            Instead, iterate each range in the map unconditionally.
     18
     19            The map can shrink when we release the lock, so we must clamp our
     20            iterator each time through the loop.
     21
     22            The map can grow when we release the lock, but we don't care because
     23            growth restarts the scavenger from the beginning.
     24
     25            * bmalloc/XLargeMap.cpp:
     26            (bmalloc::XLargeMap::removePhysical): Deleted. Not used anymore.
     27
     28            * bmalloc/XLargeMap.h:
     29            (bmalloc::XLargeMap::ranges): Added direct access for the sake of
     30            scavengeLargeObjects. (This violates our naming conventions -- I'll do
     31            a rename in a follow-up patch.)
     32
    1332016-07-13  Enrica Casucci  <enrica@apple.com>
    234
  • branches/safari-602.2.14.0-branch/Source/bmalloc/bmalloc/Heap.cpp

    r200167 r207252  
    132132void Heap::scavengeLargeObjects(std::unique_lock<StaticMutex>& lock, std::chrono::milliseconds sleepDuration)
    133133{
    134     while (XLargeRange range = m_largeFree.removePhysical()) {
     134    auto& ranges = m_largeFree.ranges();
     135    for (size_t i = ranges.size(); i-- > 0; i = std::min(i, ranges.size())) {
     136        auto range = ranges.pop(i);
     137
    135138        lock.unlock();
    136139        vmDeallocatePhysicalPagesSloppy(range.begin(), range.size());
    137140        lock.lock();
    138        
     141
    139142        range.setPhysicalSize(0);
    140         m_largeFree.add(range);
     143        ranges.push(range);
    141144
    142145        waitUntilFalse(lock, sleepDuration, m_isAllocatingPages);
  • branches/safari-602.2.14.0-branch/Source/bmalloc/bmalloc/XLargeMap.cpp

    r199746 r207252  
    7777}
    7878
    79 XLargeRange XLargeMap::removePhysical()
    80 {
    81     auto it = std::find_if(m_free.begin(), m_free.end(), [](const XLargeRange& range) {
    82         return range.physicalSize();
    83     });
    84 
    85     if (it == m_free.end())
    86         return XLargeRange();
    87 
    88     return m_free.pop(it);
    89 }
    90 
    9179} // namespace bmalloc
  • branches/safari-602.2.14.0-branch/Source/bmalloc/bmalloc/XLargeMap.h

    r199746 r207252  
    3737    void add(const XLargeRange&);
    3838    XLargeRange remove(size_t alignment, size_t);
    39     XLargeRange removePhysical();
     39    Vector<XLargeRange>& ranges() { return m_free; }
    4040
    4141private:
Note: See TracChangeset for help on using the changeset viewer.