Title: [253245] trunk/Source/bmalloc
Revision
253245
Author
[email protected]
Date
2019-12-07 00:42:49 -0800 (Sat, 07 Dec 2019)

Log Message

[bmalloc] Decommit unused region in chunk metadata.
https://bugs.webkit.org/show_bug.cgi?id=204810

Reviewed by Yusuke Suzuki.

There is an unused memory region from just after Chunk object to next page border.
We can decommit those memory to kernel at the initialization of Chunk.

* bmalloc/Heap.cpp:
(bmalloc::Heap::allocateSmallChunk):

Modified Paths

Diff

Modified: trunk/Source/bmalloc/ChangeLog (253244 => 253245)


--- trunk/Source/bmalloc/ChangeLog	2019-12-07 07:50:19 UTC (rev 253244)
+++ trunk/Source/bmalloc/ChangeLog	2019-12-07 08:42:49 UTC (rev 253245)
@@ -1,3 +1,16 @@
+2019-12-07  Basuke Suzuki  <[email protected]>
+
+        [bmalloc] Decommit unused region in chunk metadata.
+        https://bugs.webkit.org/show_bug.cgi?id=204810
+
+        Reviewed by Yusuke Suzuki.
+
+        There is an unused memory region from just after Chunk object to next page border.
+        We can decommit those memory to kernel at the initialization of Chunk.
+
+        * bmalloc/Heap.cpp:
+        (bmalloc::Heap::allocateSmallChunk):
+
 2019-11-25  Fujii Hironori  <[email protected]>
 
         Ran sort-Xcode-project-file.

Modified: trunk/Source/bmalloc/bmalloc/Heap.cpp (253244 => 253245)


--- trunk/Source/bmalloc/bmalloc/Heap.cpp	2019-12-07 07:50:19 UTC (rev 253244)
+++ trunk/Source/bmalloc/bmalloc/Heap.cpp	2019-12-07 08:42:49 UTC (rev 253245)
@@ -287,9 +287,12 @@
 
         m_freeableMemory += accountedInFreeable;
 
-        auto decommitSize = chunkSize - Chunk::metadataSize(pageSize) - accountedInFreeable;
+        auto metadataSize = Chunk::metadataSize(pageSize);
+        vmDeallocatePhysicalPagesSloppy(chunk->address(sizeof(Chunk)), metadataSize - sizeof(Chunk));
+
+        auto decommitSize = chunkSize - metadataSize - accountedInFreeable;
         if (decommitSize > 0)
-            vmDeallocatePhysicalPagesSloppy(Chunk::get(chunk)->address(chunkSize - decommitSize), decommitSize);
+            vmDeallocatePhysicalPagesSloppy(chunk->address(chunkSize - decommitSize), decommitSize);
 
         m_scavenger->schedule(0);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to