WebKit Bugzilla
Attachment 341366 Details for
Bug 185988
: JSC should put bmalloc's scavenger into mini mode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
a-backup.diff (text/plain), 10.22 KB, created by
Saam Barati
on 2018-05-25 17:29:55 PDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Saam Barati
Created:
2018-05-25 17:29:55 PDT
Size:
10.22 KB
patch
obsolete
>Index: Source/JavaScriptCore/ChangeLog >=================================================================== >--- Source/JavaScriptCore/ChangeLog (revision 232210) >+++ Source/JavaScriptCore/ChangeLog (working copy) >@@ -1,3 +1,18 @@ >+2018-05-25 Saam Barati <sbarati@apple.com> >+ >+ JSC should put bmalloc's scavenger into mini mode >+ https://bugs.webkit.org/show_bug.cgi?id=185988 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ When we InitializeThreading, we'll now enable bmalloc's mini mode >+ if the VM is in mini mode. This is an 8-10% progression on the footprint >+ at end score in run-testmem, making it a 4-5% memory score progression. >+ It's between a 0-1% regression in its time score. >+ >+ * runtime/InitializeThreading.cpp: >+ (JSC::initializeThreading): >+ > 2018-05-25 Saam Barati <sbarati@apple.com> > > Make JSC have a mini mode that kicks in when the JIT is disabled >Index: Source/JavaScriptCore/runtime/InitializeThreading.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/InitializeThreading.cpp (revision 232209) >+++ Source/JavaScriptCore/runtime/InitializeThreading.cpp (working copy) >@@ -81,6 +81,9 @@ void initializeThreading() > #if ENABLE(WEBASSEMBLY) > Wasm::Thunks::initialize(); > #endif >+ >+ if (VM::isInMiniMode()) >+ WTF::fastEnableMiniMode(); > }); > } > >Index: Source/WTF/ChangeLog >=================================================================== >--- Source/WTF/ChangeLog (revision 232209) >+++ Source/WTF/ChangeLog (working copy) >@@ -1,3 +1,14 @@ >+2018-05-25 Saam Barati <sbarati@apple.com> >+ >+ JSC should put bmalloc's scavenger into mini mode >+ https://bugs.webkit.org/show_bug.cgi?id=185988 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/FastMalloc.cpp: >+ (WTF::fastEnableMiniMode): >+ * wtf/FastMalloc.h: >+ > 2018-05-24 Carlos Alberto Lopez Perez <clopez@igalia.com> > > [GTK][WPE] Memory pressure monitor doesn't reliable notify all the subprocesses >Index: Source/WTF/wtf/FastMalloc.cpp >=================================================================== >--- Source/WTF/wtf/FastMalloc.cpp (revision 232209) >+++ Source/WTF/wtf/FastMalloc.cpp (working copy) >@@ -250,6 +250,8 @@ void fastDecommitAlignedMemory(void* ptr > OSAllocator::decommit(ptr, size); > } > >+void fastEnableMiniMode() { } >+ > } // namespace WTF > > #else // defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC >@@ -383,6 +385,11 @@ void fastDecommitAlignedMemory(void* ptr > bmalloc::api::decommitAlignedPhysical(ptr, size); > } > >+void fastEnableMiniMode() >+{ >+ bmalloc::api::enableMiniMode(); >+} >+ > } // namespace WTF > > #endif // defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC >Index: Source/WTF/wtf/FastMalloc.h >=================================================================== >--- Source/WTF/wtf/FastMalloc.h (revision 232209) >+++ Source/WTF/wtf/FastMalloc.h (working copy) >@@ -73,6 +73,8 @@ WTF_EXPORT_PRIVATE void releaseFastMallo > WTF_EXPORT_PRIVATE void fastCommitAlignedMemory(void*, size_t); > WTF_EXPORT_PRIVATE void fastDecommitAlignedMemory(void*, size_t); > >+WTF_EXPORT_PRIVATE void fastEnableMiniMode(); >+ > struct FastMallocStatistics { > size_t reservedVMBytes; > size_t committedVMBytes; >Index: Source/bmalloc/ChangeLog >=================================================================== >--- Source/bmalloc/ChangeLog (revision 232209) >+++ Source/bmalloc/ChangeLog (working copy) >@@ -1,3 +1,22 @@ >+2018-05-25 Saam Barati <sbarati@apple.com> >+ >+ JSC should put bmalloc's scavenger into mini mode >+ https://bugs.webkit.org/show_bug.cgi?id=185988 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ We expose an API for putting bmalloc into mini mode. All that means now >+ is that we'll run the scavenger more aggressively. >+ >+ * bmalloc/Scavenger.cpp: >+ (bmalloc::Scavenger::enableMiniMode): >+ (bmalloc::Scavenger::threadRunLoop): >+ * bmalloc/Scavenger.h: >+ * bmalloc/Sizes.h: >+ * bmalloc/bmalloc.cpp: >+ (bmalloc::api::enableMiniMode): >+ * bmalloc/bmalloc.h: >+ > 2018-05-23 Antti Koivisto <antti@apple.com> > > Increase the simulated memory size on PLATFORM(IOS_SIMULATOR) from 512MB to 1024MB >Index: Source/bmalloc/bmalloc/Scavenger.cpp >=================================================================== >--- Source/bmalloc/bmalloc/Scavenger.cpp (revision 232209) >+++ Source/bmalloc/bmalloc/Scavenger.cpp (working copy) >@@ -179,6 +179,13 @@ std::chrono::milliseconds Scavenger::tim > return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - m_lastPartialScavengeTime); > } > >+void Scavenger::enableMiniMode() >+{ >+ m_isInMiniMode = true; // We just store to this racily. The scavenger thread will eventually pick up the right value. >+ if (m_state == State::RunSoon) >+ run(); >+} >+ > void Scavenger::scavenge() > { > std::unique_lock<Mutex> lock(m_scavengingMutex); >@@ -377,7 +384,7 @@ void Scavenger::threadRunLoop() > > if (m_state == State::RunSoon) { > std::unique_lock<Mutex> lock(m_mutex); >- m_condition.wait_for(lock, asyncTaskSleepDuration, [&]() { return m_state != State::RunSoon; }); >+ m_condition.wait_for(lock, std::chrono::milliseconds(m_isInMiniMode ? 200 : 2000), [&]() { return m_state != State::RunSoon; }); > } > > m_state = State::Sleep; >@@ -403,11 +410,18 @@ void Scavenger::threadRunLoop() > auto timeSinceLastFullScavenge = this->timeSinceLastFullScavenge(); > auto timeSinceLastPartialScavenge = this->timeSinceLastPartialScavenge(); > auto timeSinceLastScavenge = std::min(timeSinceLastPartialScavenge, timeSinceLastFullScavenge); >- if (isUnderMemoryPressure() && freeableMemory > 4 * MB && timeSinceLastScavenge > std::chrono::milliseconds(5)) >+ >+ if (isUnderMemoryPressure() && freeableMemory > 1 * MB && timeSinceLastScavenge > std::chrono::milliseconds(5)) > return ScavengeMode::Full; > > if (!m_isProbablyGrowing) { >- if (timeSinceLastFullScavenge < std::chrono::milliseconds(1000)) >+ if (timeSinceLastFullScavenge < std::chrono::milliseconds(1000) && !m_isInMiniMode) >+ return ScavengeMode::Partial; >+ return ScavengeMode::Full; >+ } >+ >+ if (m_isInMiniMode) { >+ if (timeSinceLastFullScavenge < std::chrono::milliseconds(200)) > return ScavengeMode::Partial; > return ScavengeMode::Full; > } >@@ -421,7 +435,7 @@ void Scavenger::threadRunLoop() > // Rate limit partial scavenges. > return ScavengeMode::None; > } >- if (freeableMemory < 50 * MB) >+ if (freeableMemory < 25 * MB) > return ScavengeMode::None; > if (5 * freeableMemory < footprint()) > return ScavengeMode::None; >Index: Source/bmalloc/bmalloc/Scavenger.h >=================================================================== >--- Source/bmalloc/bmalloc/Scavenger.h (revision 232209) >+++ Source/bmalloc/bmalloc/Scavenger.h (working copy) >@@ -72,6 +72,8 @@ public: > // It's unlikely, but possible. > size_t footprint(); > >+ void enableMiniMode(); >+ > private: > enum class State { Sleep, Run, RunSoon }; > >@@ -108,6 +110,8 @@ private: > #endif > > Vector<DeferredDecommit> m_deferredDecommits; >+ >+ bool m_isInMiniMode { false }; > }; > > } // namespace bmalloc >Index: Source/bmalloc/bmalloc/Sizes.h >=================================================================== >--- Source/bmalloc/bmalloc/Sizes.h (revision 232209) >+++ Source/bmalloc/bmalloc/Sizes.h (working copy) >@@ -71,8 +71,6 @@ namespace Sizes { > static const size_t scavengerBytesPerMemoryPressureCheck = 16 * MB; > static const double memoryPressureThreshold = 0.75; > >- static const std::chrono::milliseconds asyncTaskSleepDuration = std::chrono::milliseconds(2000); >- > static const size_t maskSizeClassCount = maskSizeClassMax / alignment; > > inline constexpr size_t maskSizeClass(size_t size) >Index: Source/bmalloc/bmalloc/bmalloc.cpp >=================================================================== >--- Source/bmalloc/bmalloc/bmalloc.cpp (revision 232209) >+++ Source/bmalloc/bmalloc/bmalloc.cpp (working copy) >@@ -116,5 +116,10 @@ void decommitAlignedPhysical(void* objec > heap.externalDecommit(object, size); > } > >+void enableMiniMode() >+{ >+ PerProcess<Scavenger>::get()->enableMiniMode(); >+} >+ > } } // namespace bmalloc::api > >Index: Source/bmalloc/bmalloc/bmalloc.h >=================================================================== >--- Source/bmalloc/bmalloc/bmalloc.h (revision 232209) >+++ Source/bmalloc/bmalloc/bmalloc.h (working copy) >@@ -121,5 +121,7 @@ inline double percentAvailableMemoryInUs > BEXPORT void setScavengerThreadQOSClass(qos_class_t overrideClass); > #endif > >+BEXPORT void enableMiniMode(); >+ > } // namespace api > } // namespace bmalloc >Index: Tools/ChangeLog >=================================================================== >--- Tools/ChangeLog (revision 232218) >+++ Tools/ChangeLog (working copy) >@@ -1,3 +1,15 @@ >+2018-05-25 Saam Barati <sbarati@apple.com> >+ >+ JSC should put bmalloc's scavenger into mini mode >+ https://bugs.webkit.org/show_bug.cgi?id=185988 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch makes it so that we turn off the JIT when running run-testmem >+ that way we make JSC use its mini mode. >+ >+ * Scripts/run-testmem: >+ > 2018-05-25 Daniel Bates <dabates@apple.com> > > test-webkitpy messages logged using __main__ logger are not displayed >Index: Tools/Scripts/run-testmem >=================================================================== >--- Tools/Scripts/run-testmem (revision 232210) >+++ Tools/Scripts/run-testmem (working copy) >@@ -133,7 +133,12 @@ end > > def runTest(path, iters) > command = "#{getTestmemPath} #{path} #{iters}" >- stdout, stderr, exitCode = Open3.capture3({"DYLD_FRAMEWORK_PATH" => getBuildDirectory}, command) >+ environment = { >+ "DYLD_FRAMEWORK_PATH" => getBuildDirectory, >+ "JSC_useJIT" => "false", >+ "JSC_useRegExpJIT" => "false", >+ } >+ stdout, stderr, exitCode = Open3.capture3(environment, command) > > if $verbose > puts stdout
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185988
: 341366