Use one Scavenger thread for all Heaps
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Oct 2017 16:34:41 +0000 (16:34 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Oct 2017 16:34:41 +0000 (16:34 +0000)
commit5900c51c8fa98f1372ff9b3e06eb13ec8675f8c2
treea6dd06e56692e61077cd883a0aa3767804d410c7
parente7fcc4275aec0f11eb7ed59a5ba76ef1db705bbe
Use one Scavenger thread for all Heaps
https://bugs.webkit.org/show_bug.cgi?id=174973

Reviewed by JF Bastien.

This combines the scavengers from all Heap instances into a single scavenger. It also combines
the accounting for deciding when to run. Each Heap still controls what it means to scavenge
itself (it's all in Heap::scavenge) but the policy decisions are all controlled by Scavenger.
Because Scavenger is also the only thing that needs an AsyncTask, this removes AsyncTask and
moves all of AsyncTask's logic into Scavenger.

This appears to be a 1% progression on JetStream (with high statistical confidence: p = 0.0049).

* bmalloc.xcodeproj/project.pbxproj:
* bmalloc/AsyncTask.h: Removed.
* bmalloc/Heap.cpp:
(bmalloc::Heap::Heap):
(bmalloc::Heap::allocateSmallChunk):
(bmalloc::Heap::allocateSmallPage):
(bmalloc::Heap::deallocateSmallLine):
(bmalloc::Heap::splitAndAllocate):
(bmalloc::Heap::tryAllocateLarge):
(bmalloc::Heap::shrinkLarge):
(bmalloc::Heap::deallocateLarge):
(bmalloc::Heap::concurrentScavenge): Deleted.
(bmalloc::Heap::scheduleScavengerIfUnderMemoryPressure): Deleted.
(bmalloc::Heap::scheduleScavenger): Deleted.
* bmalloc/Heap.h:
* bmalloc/Scavenger.cpp:
(bmalloc::Scavenger::Scavenger):
(bmalloc::Scavenger::run):
(bmalloc::Scavenger::runHoldingLock):
(bmalloc::Scavenger::runSoon):
(bmalloc::Scavenger::runSoonHoldingLock):
(bmalloc::Scavenger::didStartGrowing):
(bmalloc::Scavenger::scheduleIfUnderMemoryPressure):
(bmalloc::Scavenger::scheduleIfUnderMemoryPressureHoldingLock):
(bmalloc::Scavenger::schedule):
(bmalloc::Scavenger::threadEntryPoint):
(bmalloc::Scavenger::threadRunLoop):
(bmalloc::Scavenger::setSelfQOSClass):
* bmalloc/Scavenger.h:
(bmalloc::Scavenger::willRun):
(bmalloc::Scavenger::willRunSoon):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222982 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/bmalloc/ChangeLog
Source/bmalloc/bmalloc.xcodeproj/project.pbxproj
Source/bmalloc/bmalloc/AsyncTask.h [deleted file]
Source/bmalloc/bmalloc/Heap.cpp
Source/bmalloc/bmalloc/Heap.h
Source/bmalloc/bmalloc/Scavenger.cpp
Source/bmalloc/bmalloc/Scavenger.h