[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 10:51:40 PST 2011
https://bugs.webkit.org/show_bug.cgi?id=45186
Adam Roben (aroben) <aroben at apple.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #78538|review?, commit-queue? |review-
Flag| |
--- Comment #8 from Adam Roben (aroben) <aroben at apple.com> 2011-01-14 10:51:40 PST ---
(From update of attachment 78538)
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.
--
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