Title: [243389] trunk/Source/bmalloc
Revision
243389
Author
[email protected]
Date
2019-03-22 10:43:29 -0700 (Fri, 22 Mar 2019)

Log Message

[BMalloc] No need to delay deallocating chunks based on recent use
https://bugs.webkit.org/show_bug.cgi?id=196121

Reviewed by Mark Lam.

The "used since last scavenge" logic is not needed for small chunks since their memory isn't decommitted directly.
We can deallocate small chunks immediately as that adds them to the LargeRange free list.  That free list employs the
"used since last scavenge" logic before the scavenger decommits the backing memory.

* bmalloc/Chunk.h:
(bmalloc::Chunk::usedSinceLastScavenge): Deleted.
(bmalloc::Chunk::clearUsedSinceLastScavenge): Deleted.
(bmalloc::Chunk::setUsedSinceLastScavenge): Deleted.
* bmalloc/Heap.cpp:
(bmalloc::Heap::scavenge):
(bmalloc::Heap::allocateSmallPage):

Modified Paths

Diff

Modified: trunk/Source/bmalloc/ChangeLog (243388 => 243389)


--- trunk/Source/bmalloc/ChangeLog	2019-03-22 17:40:51 UTC (rev 243388)
+++ trunk/Source/bmalloc/ChangeLog	2019-03-22 17:43:29 UTC (rev 243389)
@@ -1,3 +1,22 @@
+2019-03-21  Michael Saboff  <[email protected]>
+
+        [BMalloc] No need to delay deallocating chunks based on recent use
+        https://bugs.webkit.org/show_bug.cgi?id=196121
+
+        Reviewed by Mark Lam.
+
+        The "used since last scavenge" logic is not needed for small chunks since their memory isn't decommitted directly.
+        We can deallocate small chunks immediately as that adds them to the LargeRange free list.  That free list employs the
+        "used since last scavenge" logic before the scavenger decommits the backing memory.
+
+        * bmalloc/Chunk.h:
+        (bmalloc::Chunk::usedSinceLastScavenge): Deleted.
+        (bmalloc::Chunk::clearUsedSinceLastScavenge): Deleted.
+        (bmalloc::Chunk::setUsedSinceLastScavenge): Deleted.
+        * bmalloc/Heap.cpp:
+        (bmalloc::Heap::scavenge):
+        (bmalloc::Heap::allocateSmallPage):
+
 2019-03-21  Brady Eidson  <[email protected]>
 
         Certain WebProcesses should opt-out of the freezer.

Modified: trunk/Source/bmalloc/bmalloc/Chunk.h (243388 => 243389)


--- trunk/Source/bmalloc/bmalloc/Chunk.h	2019-03-22 17:40:51 UTC (rev 243388)
+++ trunk/Source/bmalloc/bmalloc/Chunk.h	2019-03-22 17:43:29 UTC (rev 243389)
@@ -45,10 +45,6 @@
     void deref() { BASSERT(m_refCount); --m_refCount; }
     unsigned refCount() { return m_refCount; }
 
-    bool usedSinceLastScavenge() { return m_usedSinceLastScavenge; }
-    void clearUsedSinceLastScavenge() { m_usedSinceLastScavenge = false; }
-    void setUsedSinceLastScavenge() { m_usedSinceLastScavenge = true; }
-
     size_t offset(void*);
 
     char* address(size_t offset);
@@ -63,7 +59,6 @@
 
 private:
     size_t m_refCount { };
-    bool m_usedSinceLastScavenge: 1;
     List<SmallPage> m_freePages { };
 
     std::array<SmallLine, chunkSize / smallLineSize> m_lines { };

Modified: trunk/Source/bmalloc/bmalloc/Heap.cpp (243388 => 243389)


--- trunk/Source/bmalloc/bmalloc/Heap.cpp	2019-03-22 17:40:51 UTC (rev 243388)
+++ trunk/Source/bmalloc/bmalloc/Heap.cpp	2019-03-22 17:43:29 UTC (rev 243389)
@@ -202,18 +202,8 @@
     }
 
     for (auto& list : m_chunkCache) {
-        for (auto iter = list.begin(); iter != list.end(); ) {
-            Chunk* chunk = *iter;
-            if (chunk->usedSinceLastScavenge()) {
-                chunk->clearUsedSinceLastScavenge();
-                deferredDecommits++;
-                ++iter;
-                continue;
-            }
-            ++iter;
-            list.remove(chunk);
-            deallocateSmallChunk(chunk, &list - &m_chunkCache[0]);
-        }
+        while (!list.isEmpty())
+            deallocateSmallChunk(list.pop(), &list - &m_chunkCache[0]);
     }
 
     for (LargeRange& range : m_largeFree) {
@@ -316,7 +306,6 @@
         Chunk* chunk = m_freePages[pageClass].tail();
 
         chunk->ref();
-        chunk->setUsedSinceLastScavenge();
 
         SmallPage* page = chunk->freePages().pop();
         if (chunk->freePages().isEmpty())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to