Summary: | Block freeing thread should sleep indefinitely when there's no work to do | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Mark Hahnenberg <mhahnenberg> | ||||||||
Component: | JavaScriptCore | Assignee: | Mark Hahnenberg <mhahnenberg> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | ggaren, levin+threading, webkit.review.bot, yong.li.webkit | ||||||||
Priority: | P2 | ||||||||||
Version: | 528+ (Nightly build) | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
Attachments: |
|
Description
Mark Hahnenberg
2012-10-01 15:44:24 PDT
Created attachment 166562 [details]
Patch
Comment on attachment 166562 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=166562&action=review This fix looks correct, but I think it can get better. > Source/JavaScriptCore/heap/BlockAllocator.h:111 > + m_numberOfFreeBlocks++; Can we just use m_numberOfFreeBlocks != 0, instead of a separate m_blocksNeedFreeing boolean, to tell if we need to free anything? > Source/JavaScriptCore/heap/BlockAllocator.h:118 > + MutexLocker mutexLocker(m_freeBlockConditionLock); > + if (!m_blocksNeedFreeing) { > + m_blocksNeedFreeing = true; > + m_freeBlockCondition.signal(); > + } Rather than doing this unconditionally, I'd prefer to see this done only if m_numberOfFreeBlocks was 0 when we acquired the lock. Created attachment 166587 [details]
Patch
Comment on attachment 166587 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=166587&action=review r=me > Source/JavaScriptCore/heap/BlockAllocator.h:115 > + MutexLocker mutexLocker(m_freeBlockConditionLock); > + if (!numberOfFreeBlocks) "mutexLocker" should be scoped inside "if (!numberOfFreeBlocks)", so we only acquire the mutex on the transition from zero to non-zero. Please make this change before landing. Committed r130212: <http://trac.webkit.org/changeset/130212> *** Bug 90622 has been marked as a duplicate of this bug. *** Reopening because this wasn't completely fixed. Created attachment 169199 [details]
Patch
Comment on attachment 169199 [details]
Patch
r=me
Comment on attachment 169199 [details] Patch Clearing flags on attachment: 169199 Committed r131619: <http://trac.webkit.org/changeset/131619> All reviewed patches have been landed. Closing bug. |