Changeset 244979 in webkit
- Timestamp:
- May 6, 2019 2:44:01 PM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r244975 r244979 1 2019-05-06 Chris Dumez <cdumez@apple.com> 2 3 Terminate service workers that use too much CPU / power 4 https://bugs.webkit.org/show_bug.cgi?id=197626 5 <rdar://problem/50374707> 6 7 Reviewed by Geoffrey Garen. 8 9 Terminate service worker processes that use over 50% CPU on average over the last 8 minutes, 10 similarly to what we do for background WebContent processes. 11 12 * UIProcess/WebProcessProxy.cpp: 13 (WebKit::WebProcessProxy::didExceedCPULimit): 14 * WebProcess/WebProcess.cpp: 15 (WebKit::WebProcess::initializeProcess): 16 * WebProcess/cocoa/WebProcessCocoa.mm: 17 (WebKit::WebProcess::updateCPULimit): 18 (WebKit::WebProcess::updateCPUMonitorState): 19 1 20 2019-05-06 Daniel Bates <dabates@apple.com> 2 21 -
trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp
r244936 r244979 1339 1339 return; 1340 1340 1341 RELEASE_LOG_ERROR(PerformanceLogging, "%p - WebProcessProxy::didExceedCPULimit() Terminating background WebProcess with pid %d that has exceeded the background CPU limit", this, processIdentifier()); 1341 if (isServiceWorkerProcess()) 1342 RELEASE_LOG_ERROR(PerformanceLogging, "%p - WebProcessProxy::didExceedCPULimit() Terminating Service Worker process with pid %d that has exceeded the background CPU limit", this, processIdentifier()); 1343 else 1344 RELEASE_LOG_ERROR(PerformanceLogging, "%p - WebProcessProxy::didExceedCPULimit() Terminating background WebProcess with pid %d that has exceeded the background CPU limit", this, processIdentifier()); 1342 1345 logDiagnosticMessageForResourceLimitTermination(DiagnosticLoggingKeys::exceededBackgroundCPULimitKey()); 1343 1346 requestTermination(ProcessTerminationReason::ExceededCPULimit); -
trunk/Source/WebKit/WebProcess/WebProcess.cpp
r244091 r244979 238 238 239 239 platformInitializeProcess(parameters); 240 updateCPULimit(); 240 241 } 241 242 -
trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
r244955 r244979 122 122 #if PLATFORM(MAC) 123 123 static const Seconds cpuMonitoringInterval { 8_min }; 124 static const double serviceWorkerCPULimit { 0.5 }; // 50% average CPU usage over 8 minutes. 124 125 #endif 125 126 … … 578 579 #if PLATFORM(MAC) 579 580 Optional<double> cpuLimit; 580 581 // Use the largest limit among all pages in this process. 582 for (auto& page : m_pageMap.values()) { 583 auto pageCPULimit = page->cpuLimit(); 584 if (!pageCPULimit) { 585 cpuLimit = WTF::nullopt; 586 break; 581 if (m_processType == ProcessType::ServiceWorker) 582 cpuLimit = serviceWorkerCPULimit; 583 else { 584 // Use the largest limit among all pages in this process. 585 for (auto& page : m_pageMap.values()) { 586 auto pageCPULimit = page->cpuLimit(); 587 if (!pageCPULimit) { 588 cpuLimit = WTF::nullopt; 589 break; 590 } 591 if (!cpuLimit || pageCPULimit > cpuLimit.value()) 592 cpuLimit = pageCPULimit; 587 593 } 588 if (!cpuLimit || pageCPULimit > cpuLimit.value())589 cpuLimit = pageCPULimit;590 594 } 591 595 … … 609 613 if (!m_cpuMonitor) { 610 614 m_cpuMonitor = std::make_unique<CPUMonitor>(cpuMonitoringInterval, [this](double cpuUsage) { 611 RELEASE_LOG(PerformanceLogging, "%p - WebProcess exceeded CPU limit of %.1f%% (was using %.1f%%) hasVisiblePages? %d", this, m_cpuLimit.value() * 100, cpuUsage * 100, hasVisibleWebPage()); 615 if (m_processType == ProcessType::ServiceWorker) 616 RELEASE_LOG_ERROR(PerformanceLogging, "%p - Service worker process exceeded CPU limit of %.1f%% (was using %.1f%%)", this, m_cpuLimit.value() * 100, cpuUsage * 100); 617 else 618 RELEASE_LOG_ERROR(PerformanceLogging, "%p - WebProcess exceeded CPU limit of %.1f%% (was using %.1f%%) hasVisiblePages? %d", this, m_cpuLimit.value() * 100, cpuUsage * 100, hasVisibleWebPage()); 612 619 parentProcessConnection()->send(Messages::WebProcessProxy::DidExceedCPULimit(), 0); 613 620 });
Note: See TracChangeset
for help on using the changeset viewer.