- Revision
- 92231
- Author
- msab...@apple.com
- Date
- 2011-08-02 14:19:05 -0700 (Tue, 02 Aug 2011)
Log Message
Virtual copying of FastMalloc allocated memory causes madvise MADV_FREE_REUSABLE errors
https://bugs.webkit.org/show_bug.cgi?id=65502
Reviewed by Anders Carlsson.
Source/_javascript_Core:
With the fix of the issues causing madvise MADV_FREE_REUSABLE to fail,
added an assert to the return code of madvise to catch any regressions.
* wtf/TCSystemAlloc.cpp:
(TCMalloc_SystemRelease):
Source/WebCore:
Change the vm_copy in PurgeableBuffer::create to be a memcpy. The
vm_copy causes the process to have additional references to the same
memory region. These additional reference caused madvise(MADV_FREE_REUSABLE)
to fail when it encountered such pages.
No tests added this is a resource defect and not a functional issue.
* platform/mac/PurgeableBufferMac.cpp:
(WebCore::PurgeableBuffer::create):
Source/WebKit2:
Changed OOL message to use MACH_MSG_PHYSICAL_COPY flag instead of virtual flag
so that the original memory region isn't referenced by the message and ultimately
the receiving process. The additional reference caused madvise(MADV_FREE_REUSABLE)
to fail when it encountered such pages.
* Platform/CoreIPC/mac/ConnectionMac.cpp:
(CoreIPC::Connection::sendOutgoingMessage):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (92230 => 92231)
--- trunk/Source/_javascript_Core/ChangeLog 2011-08-02 21:13:05 UTC (rev 92230)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-08-02 21:19:05 UTC (rev 92231)
@@ -1,3 +1,16 @@
+2011-08-01 Michael Saboff <msab...@apple.com>
+
+ Virtual copying of FastMalloc allocated memory causes madvise MADV_FREE_REUSABLE errors
+ https://bugs.webkit.org/show_bug.cgi?id=65502
+
+ Reviewed by Anders Carlsson.
+
+ With the fix of the issues causing madvise MADV_FREE_REUSABLE to fail,
+ added an assert to the return code of madvise to catch any regressions.
+
+ * wtf/TCSystemAlloc.cpp:
+ (TCMalloc_SystemRelease):
+
2011-08-02 Anders Carlsson <ander...@apple.com>
Fix Windows build.
Modified: trunk/Source/_javascript_Core/wtf/TCSystemAlloc.cpp (92230 => 92231)
--- trunk/Source/_javascript_Core/wtf/TCSystemAlloc.cpp 2011-08-02 21:13:05 UTC (rev 92230)
+++ trunk/Source/_javascript_Core/wtf/TCSystemAlloc.cpp 2011-08-02 21:19:05 UTC (rev 92231)
@@ -392,7 +392,12 @@
void TCMalloc_SystemRelease(void* start, size_t length)
{
- while (madvise(start, length, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN) { }
+ int madviseResult;
+
+ while ((madviseResult = madvise(start, length, MADV_FREE_REUSABLE)) == -1 && errno == EAGAIN) { }
+
+ // Although really advisory, if madvise fail, we want to know about it.
+ ASSERT_UNUSED(madviseResult, madviseResult != -1);
}
#elif HAVE(MADV_FREE) || HAVE(MADV_DONTNEED)
Modified: trunk/Source/WebCore/ChangeLog (92230 => 92231)
--- trunk/Source/WebCore/ChangeLog 2011-08-02 21:13:05 UTC (rev 92230)
+++ trunk/Source/WebCore/ChangeLog 2011-08-02 21:19:05 UTC (rev 92231)
@@ -1,3 +1,20 @@
+2011-08-01 Michael Saboff <msab...@apple.com>
+
+ Virtual copying of FastMalloc allocated memory causes madvise MADV_FREE_REUSABLE errors
+ https://bugs.webkit.org/show_bug.cgi?id=65502
+
+ Reviewed by Anders Carlsson.
+
+ Change the vm_copy in PurgeableBuffer::create to be a memcpy. The
+ vm_copy causes the process to have additional references to the same
+ memory region. These additional reference caused madvise(MADV_FREE_REUSABLE)
+ to fail when it encountered such pages.
+
+ No tests added this is a resource defect and not a functional issue.
+
+ * platform/mac/PurgeableBufferMac.cpp:
+ (WebCore::PurgeableBuffer::create):
+
2011-08-02 Stephen White <senorbla...@chromium.org>
[Chromium] Remove an unnecessary readback during accelerated
Modified: trunk/Source/WebCore/platform/mac/PurgeableBufferMac.cpp (92230 => 92231)
--- trunk/Source/WebCore/platform/mac/PurgeableBufferMac.cpp 2011-08-02 21:13:05 UTC (rev 92230)
+++ trunk/Source/WebCore/platform/mac/PurgeableBufferMac.cpp 2011-08-02 21:19:05 UTC (rev 92231)
@@ -64,14 +64,8 @@
if (ret != KERN_SUCCESS)
return nullptr;
- ret = vm_copy(mach_task_self(), reinterpret_cast<vm_address_t>(data), size, buffer);
+ memcpy(reinterpret_cast<char*>(buffer), data, size);
- ASSERT(ret == KERN_SUCCESS);
- if (ret != KERN_SUCCESS) {
- vm_deallocate(mach_task_self(), buffer, size);
- return nullptr;
- }
-
return adoptPtr(new PurgeableBuffer(reinterpret_cast<char*>(buffer), size));
}
Modified: trunk/Source/WebKit2/ChangeLog (92230 => 92231)
--- trunk/Source/WebKit2/ChangeLog 2011-08-02 21:13:05 UTC (rev 92230)
+++ trunk/Source/WebKit2/ChangeLog 2011-08-02 21:19:05 UTC (rev 92231)
@@ -1,3 +1,18 @@
+2011-08-01 Michael Saboff <msab...@apple.com>
+
+ Virtual copying of FastMalloc allocated memory causes madvise MADV_FREE_REUSABLE errors
+ https://bugs.webkit.org/show_bug.cgi?id=65502
+
+ Reviewed by Anders Carlsson.
+
+ Changed OOL message to use MACH_MSG_PHYSICAL_COPY flag instead of virtual flag
+ so that the original memory region isn't referenced by the message and ultimately
+ the receiving process. The additional reference caused madvise(MADV_FREE_REUSABLE)
+ to fail when it encountered such pages.
+
+ * Platform/CoreIPC/mac/ConnectionMac.cpp:
+ (CoreIPC::Connection::sendOutgoingMessage):
+
2011-07-29 Jocelyn Turcotte <jocelyn.turco...@nokia.com>
[Qt] Add QtWebProcess in PATH at runtime for WebKit2 API auto tests.
Modified: trunk/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp (92230 => 92231)
--- trunk/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp 2011-08-02 21:13:05 UTC (rev 92230)
+++ trunk/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp 2011-08-02 21:19:05 UTC (rev 92231)
@@ -155,7 +155,7 @@
if (messageSize > sizeof(buffer)) {
messageBodyIsOOL = true;
- attachments.append(Attachment(arguments->buffer(), arguments->bufferSize(), MACH_MSG_VIRTUAL_COPY, false));
+ attachments.append(Attachment(arguments->buffer(), arguments->bufferSize(), MACH_MSG_PHYSICAL_COPY, false));
numberOfOOLMemoryDescriptors++;
messageSize = machMessageSize(0, numberOfPortDescriptors, numberOfOOLMemoryDescriptors);
}