Changeset 130212 in webkit
- Timestamp:
- Oct 2, 2012, 2:24:19 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r130109 r130212 1 2012-10-01 Mark Hahnenberg <mhahnenberg@apple.com> 2 3 Block freeing thread should sleep indefinitely when there's no work to do 4 https://bugs.webkit.org/show_bug.cgi?id=98084 5 6 Reviewed by Geoffrey Garen. 7 8 Currently the block freeing thread wakes up once a second to check if there are any blocks 9 for it to release back to the OS. This is wasteful. We should change it to sleep when it 10 realizes there are no more blocks to free. Any thread that returns a block to the BlockAllocator 11 should then notify the block freeing thread that there is more work to do now. 12 13 * heap/BlockAllocator.cpp: 14 (JSC::BlockAllocator::BlockAllocator): 15 (JSC::BlockAllocator::blockFreeingThreadMain): 16 * heap/BlockAllocator.h: 17 (BlockAllocator): 18 (JSC::BlockAllocator::deallocate): 19 1 20 2012-10-01 Michael Saboff <msaboff@apple.com> 2 21 -
trunk/Source/JavaScriptCore/heap/BlockAllocator.cpp
r124250 r130212 139 139 DeadBlock::destroy(block).deallocate(); 140 140 } 141 142 // Sleep until there is actually work to do rather than waking up every second to check. 143 MutexLocker locker(m_freeBlockConditionLock); 144 m_freeBlockLock.Lock(); 145 while (!m_numberOfFreeBlocks && !m_blockFreeingThreadShouldQuit) { 146 m_freeBlockLock.Unlock(); 147 m_freeBlockCondition.wait(m_freeBlockConditionLock); 148 m_freeBlockLock.Lock(); 149 } 150 m_freeBlockLock.Unlock(); 141 151 } 142 152 } -
trunk/Source/JavaScriptCore/heap/BlockAllocator.h
r124250 r130212 105 105 inline void BlockAllocator::deallocate(PageAllocationAligned allocation) 106 106 { 107 SpinLockHolder locker(&m_freeBlockLock); 108 m_freeBlocks.push(DeadBlock::create(allocation)); 109 m_numberOfFreeBlocks++; 107 size_t numberOfFreeBlocks; 108 { 109 SpinLockHolder locker(&m_freeBlockLock); 110 m_freeBlocks.push(DeadBlock::create(allocation)); 111 numberOfFreeBlocks = m_numberOfFreeBlocks++; 112 } 113 114 if (!numberOfFreeBlocks) { 115 MutexLocker mutexLocker(m_freeBlockConditionLock); 116 m_freeBlockCondition.signal(); 117 } 110 118 } 111 119
Note:
See TracChangeset
for help on using the changeset viewer.