Changeset 229894 in webkit
- Timestamp:
- Mar 23, 2018 5:41:44 AM (6 years ago)
- Location:
- trunk/Source/WTF
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r229893 r229894 1 2018-03-23 Carlos Alberto Lopez Perez <clopez@igalia.com> 2 3 WebProcess memory monitor thresholds should be better tuned for embedded systems. 4 https://bugs.webkit.org/show_bug.cgi?id=183773 5 6 Reviewed by Yusuke Suzuki. 7 8 Take into account the total system RAM for the thresholds calculation. 9 10 For systems with more than 3GB the conservative and strict thresholds remain as they are, 11 but for systems with less RAM the thresholds are dynamically configured as follows: 12 13 - Conservative threshold (release non critical memory) if WebProcess using more than 33% of the total RAM. 14 - Strict threshold (release all possible memory) if WebProcess using more than 50% of the total RAM. 15 16 The Kill threshold is also modified. Now it is capped at 90% of the total RAM. 17 18 * wtf/MemoryPressureHandler.cpp: 19 (WTF::thresholdForMemoryKillWithProcessState): 20 (WTF::thresholdForPolicy): 21 (WTF::MemoryPressureHandler::shrinkOrDie): 22 1 23 2018-03-23 Yusuke Suzuki <utatane.tea@gmail.com> 2 24 -
trunk/Source/WTF/wtf/MemoryPressureHandler.cpp
r229195 r229894 29 29 #include <wtf/MemoryFootprint.h> 30 30 #include <wtf/NeverDestroyed.h> 31 #include <wtf/RAMSize.h> 31 32 32 33 #define LOG_CHANNEL_PREFIX Log … … 85 86 static size_t thresholdForMemoryKillWithProcessState(WebsamProcessState processState, unsigned tabCount) 86 87 { 88 size_t baseThreshold = 2 * GB; 87 89 #if CPU(X86_64) || CPU(ARM64) 88 size_t baseThreshold;89 90 if (processState == WebsamProcessState::Active) 90 91 baseThreshold = 4 * GB; 91 else 92 baseThreshold = 2 * GB; 93 if (tabCount <= 1) 94 return baseThreshold; 95 return baseThreshold + (std::min(tabCount - 1, 4u) * 1 * GB); 92 if (tabCount > 1) 93 baseThreshold += std::min(tabCount - 1, 4u) * 1 * GB; 96 94 #else 97 UNUSED_PARAM(processState);98 UNUSED_PARAM(tabCount);99 return 3 * GB; 100 #endif 95 if ((tabCount > 1) || (processState == WebsamProcessState::Active)) 96 baseThreshold = 3 * GB; 97 #endif 98 return std::min(baseThreshold, static_cast<size_t>(ramSize() * 0.9)); 101 99 } 102 100 … … 115 113 static size_t thresholdForPolicy(MemoryUsagePolicy policy) 116 114 { 115 const size_t baseThresholdForPolicy = std::min(3 * GB, ramSize()); 117 116 switch (policy) { 118 117 case MemoryUsagePolicy::Conservative: 119 return 1 * GB;118 return baseThresholdForPolicy / 3; 120 119 case MemoryUsagePolicy::Strict: 121 return 1.5 * GB;120 return baseThresholdForPolicy / 2; 122 121 case MemoryUsagePolicy::Unrestricted: 123 122 default: … … 151 150 } 152 151 152 WTFLogAlways("Unable to shrink memory footprint of process (%lu MB) below the kill thresold (%lu MB). Killed\n", footprint.value() / MB, thresholdForMemoryKill() / MB); 153 153 RELEASE_ASSERT(m_memoryKillCallback); 154 154 m_memoryKillCallback();
Note: See TracChangeset
for help on using the changeset viewer.