[Webkit-unassigned] [Bug 45186] Use the Windows thread pool instead of an extra thread for FastMalloc scavenging

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jan 14 12:29:06 PST 2011


https://bugs.webkit.org/show_bug.cgi?id=45186


Adam Roben (aroben) <aroben at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #78976|review?, commit-queue?      |review-
               Flag|                            |




--- Comment #12 from Adam Roben (aroben) <aroben at apple.com>  2011-01-14 12:29:06 PST ---
(From update of attachment 78976)
View in context: https://bugs.webkit.org/attachment.cgi?id=78976&action=review

> Source/JavaScriptCore/wtf/FastMalloc.cpp:1540
> +ALWAYS_INLINE bool TCMalloc_PageHeap::isScavengerSuspended()
> +{
> +    return m_scavengingSuspended;
> +}
> +ALWAYS_INLINE void TCMalloc_PageHeap::scheduleScavenger()
> +{
> +    m_scavengingSuspended = false;
> +    dispatch_resume(m_scavengeTimer);
> +}
> +
> +ALWAYS_INLINE void TCMalloc_PageHeap::rescheduleScavenger()
> +{
> +    // Nothing to do here for libdispatch.
> +}
> +
> +ALWAYS_INLINE void TCMalloc_PageHeap::suspendScavenger()
> +{
> +    m_scavengingSuspended = true;
> +    dispatch_suspend(m_scavengeTimer);
> +}

These functions (and their Windows equivalents) should probably assert that the pageheap lock is held.

> Source/JavaScriptCore/wtf/FastMalloc.cpp:1561
> +    CreateTimerQueueTimer(&m_scavengeQueueTimer, 0, scavengerTimerFired, 0, kScavengeDelayInSeconds * 1000, 0, WT_EXECUTEONLYONCE);

It would be helpful to add a comment here about how rescheduling a non-repeating timer doesn't work.

> Source/JavaScriptCore/wtf/FastMalloc.cpp:2459
> +    {
> +        SpinLockHolder h(&pageheap_lock);
> +        pageheap->scavenge();
> +    }
> +
> +    if (shouldScavenge()) {
> +        suspendScavenger();
> +        return;
> +    }
> +
> +    rescheduleScavenger();

This doesn't look right. I think we need to hold pageheap_lock when calling the various *scavenge* functions.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list