[webkit-reviews] review denied: [Bug 45186] Use the Windows thread pool instead of an extra thread for FastMalloc scavenging : [Attachment 78538] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jan 14 10:51:40 PST 2011


Adam Roben (aroben) <aroben at apple.com> has denied Patrick R. Gansterer
<paroga at paroga.com>'s request for review:
Bug 45186: Use the Windows thread pool instead of an extra thread for
FastMalloc scavenging
https://bugs.webkit.org/show_bug.cgi?id=45186

Attachment 78538: Patch
https://bugs.webkit.org/attachment.cgi?id=78538&action=review

------- Additional Comments from Adam Roben (aroben) <aroben at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=78538&action=review

It's really too bad we can't reuse a previously-paused timer queue timer!

> Source/JavaScriptCore/wtf/FastMalloc.cpp:1536
> +ALWAYS_INLINE void TCMalloc_PageHeap::signalScavenger()
> +{
> +    ASSERT(IsHeld(pageheap_lock));
> +    if (!m_scavengingScheduled && shouldScavenge()) {
> +	   m_scavengingScheduled = true;
> +	   dispatch_resume(m_scavengeTimer);
> +    }
> +}
> +
> +#elif OS(WINDOWS)
> +
> +static void CALLBACK scavengerTimerFired(void* context, BOOLEAN)
> +{
> +    static_cast<TCMalloc_PageHeap*>(context)->periodicScavenge();
> +}
> +
> +void TCMalloc_PageHeap::initializeScavenger()
> +{
> +    m_scavengeQueueTimer = 0;
> +}
> +
> +ALWAYS_INLINE void TCMalloc_PageHeap::signalScavenger()
> +{
> +    ASSERT(IsHeld(pageheap_lock));
> +    if (!m_scavengeQueueTimer && shouldScavenge()) {
> +	   DWORD period = kScavengeDelayInSeconds * 1000;
> +	   CreateTimerQueueTimer(&m_scavengeQueueTimer, 0, scavengerTimerFired,
0, period, period, WT_EXECUTEDEFAULT);
> +    }
> +}

It would be nice if we could share a little more of the logic in
signalScavenger(). Adding some new functions like isScavengerScheduled() (or
its opposite, isScavengerSuspended()) and scheduleScavenger() should make that
pretty easy.

> Source/JavaScriptCore/wtf/FastMalloc.cpp:2421
> +#if HAVE(DISPATCH_H)
> +	   m_scavengingScheduled = false;
> +	   dispatch_suspend(m_scavengeTimer);
> +#elif OS(WINDOWS)
> +	   HANDLE scavengeQueueTimer = m_scavengeQueueTimer;
> +	   m_scavengeQueueTimer = 0;
> +	   DeleteTimerQueueTimer(0, scavengeQueueTimer, 0);
>  #endif

Maybe a suspendScavenger() function would make this cleaner.


More information about the webkit-reviews mailing list