RESOLVED FIXED 199195
Perform less work when a pre-warmed WebProcess is suspended or resumed.
https://bugs.webkit.org/show_bug.cgi?id=199195
Summary Perform less work when a pre-warmed WebProcess is suspended or resumed.
Per Arne Vollan
Reported 2019-06-25 11:18:10 PDT
This is a confirmed improvement in page load time.
Attachments
Patch (1.99 KB, patch)
2019-06-25 11:21 PDT, Per Arne Vollan
no flags
Patch (2.07 KB, patch)
2019-06-25 13:05 PDT, Per Arne Vollan
no flags
Patch (2.36 KB, patch)
2019-06-28 11:00 PDT, Per Arne Vollan
no flags
Patch (2.43 KB, patch)
2019-06-28 11:09 PDT, Per Arne Vollan
no flags
Patch (2.93 KB, patch)
2019-06-29 21:47 PDT, Per Arne Vollan
darin: review+
Patch (2.47 KB, patch)
2019-07-01 07:42 PDT, Per Arne Vollan
no flags
Per Arne Vollan
Comment 1 2019-06-25 11:21:34 PDT
Per Arne Vollan
Comment 2 2019-06-25 13:05:26 PDT
Brent Fulgham
Comment 3 2019-06-26 07:42:46 PDT
Comment on attachment 372853 [details] Patch R=me
Chris Dumez
Comment 4 2019-06-26 07:43:29 PDT
Comment on attachment 372853 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=372853&action=review > Source/WebKit/WebProcess/WebProcess.cpp:1476 > + return; Seems like it should do something like this before returning: if (shouldAcknowledgeWhenReadyToSuspend == ShouldAcknowledgeWhenReadyToSuspend::Yes) { RELEASE_LOG(ProcessSuspension, "%p - WebProcess::actualPrepareToSuspend() Sending ProcessReadyToSuspend IPC message", this); parentProcessConnection()->send(Messages::WebProcessProxy::ProcessReadyToSuspend(), 0); } > Source/WebKit/WebProcess/WebProcess.cpp:1536 > + ASSERT(m_processType != ProcessType::PrewarmedWebContent); I am not convinced this assert is correct. Why do you think it is?
Chris Dumez
Comment 5 2019-06-26 07:45:46 PDT
Comment on attachment 372853 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=372853&action=review > Source/WebKit/ChangeLog:8 > + Return early from WebProcess::actualPrepareToSuspend and WebProcess::processDidResume Have you tried not doing the IPC round trip altogether?
Per Arne Vollan
Comment 6 2019-06-26 11:21:28 PDT
(In reply to Chris Dumez from comment #5) > Comment on attachment 372853 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=372853&action=review > > > Source/WebKit/ChangeLog:8 > > + Return early from WebProcess::actualPrepareToSuspend and WebProcess::processDidResume > > Have you tried not doing the IPC round trip altogether? I will try that. Thanks for reviewing, everyone!
Per Arne Vollan
Comment 7 2019-06-28 11:00:31 PDT
Per Arne Vollan
Comment 8 2019-06-28 11:03:29 PDT
(In reply to Chris Dumez from comment #5) > Comment on attachment 372853 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=372853&action=review > > > Source/WebKit/ChangeLog:8 > > + Return early from WebProcess::actualPrepareToSuspend and WebProcess::processDidResume > > Have you tried not doing the IPC round trip altogether? I am still evaluating a patch for this, and might propose a patch later on depending on the results. Perhaps we also could consider suspending the pre-warmed process after some timeout, instead of an immediate suspension?
Per Arne Vollan
Comment 9 2019-06-28 11:09:51 PDT
Radar WebKit Bug Importer
Comment 10 2019-06-28 13:43:58 PDT
Per Arne Vollan
Comment 11 2019-06-28 16:37:58 PDT
It seems the performance benefit of not doing the IPC roundtrip is comparable to the approach in the current patch, so I think we can stick with this approach.
Sam Weinig
Comment 12 2019-06-29 09:48:06 PDT
Comment on attachment 373134 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=373134&action=review > Source/WebKit/WebProcess/WebProcess.cpp:1474 > +#if PLATFORM(COCOA) What makes this cocoa specific? Can this have a more specific conditional? #if SUPPORTS(...).
Per Arne Vollan
Comment 13 2019-06-29 12:53:54 PDT
(In reply to Sam Weinig from comment #12) > Comment on attachment 373134 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=373134&action=review > > > Source/WebKit/WebProcess/WebProcess.cpp:1474 > > +#if PLATFORM(COCOA) > > What makes this cocoa specific? Can this have a more specific conditional? > #if SUPPORTS(...). Currently, m_processType is only declared for cocoa platforms. Perhaps we could declare it for all platforms, and let it have the default value 'ProcessType::WebContent' for platforms not supporting pre-warming?
Sam Weinig
Comment 14 2019-06-29 21:24:14 PDT
(In reply to Per Arne Vollan from comment #13) > (In reply to Sam Weinig from comment #12) > > Comment on attachment 373134 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=373134&action=review > > > > > Source/WebKit/WebProcess/WebProcess.cpp:1474 > > > +#if PLATFORM(COCOA) > > > > What makes this cocoa specific? Can this have a more specific conditional? > > #if SUPPORTS(...). > > Currently, m_processType is only declared for cocoa platforms. Perhaps we > could declare it for all platforms, and let it have the default value > 'ProcessType::WebContent' for platforms not supporting pre-warming? Declaring it for all platforms would be fine and/or guarding it with a more specific conditional. PLATFORM(COCOA) should only be used for conditions that are really Cocoa specific (e.g. requires NSColor).
Per Arne Vollan
Comment 15 2019-06-29 21:38:43 PDT
(In reply to Sam Weinig from comment #14) > (In reply to Per Arne Vollan from comment #13) > > (In reply to Sam Weinig from comment #12) > > > Comment on attachment 373134 [details] > > > Patch > > > > > > View in context: > > > https://bugs.webkit.org/attachment.cgi?id=373134&action=review > > > > > > > Source/WebKit/WebProcess/WebProcess.cpp:1474 > > > > +#if PLATFORM(COCOA) > > > > > > What makes this cocoa specific? Can this have a more specific conditional? > > > #if SUPPORTS(...). > > > > Currently, m_processType is only declared for cocoa platforms. Perhaps we > > could declare it for all platforms, and let it have the default value > > 'ProcessType::WebContent' for platforms not supporting pre-warming? > > Declaring it for all platforms would be fine and/or guarding it with a more > specific conditional. PLATFORM(COCOA) should only be used for conditions > that are really Cocoa specific (e.g. requires NSColor). Sounds good! I will update the patch. Thanks for reviewing!
Per Arne Vollan
Comment 16 2019-06-29 21:47:13 PDT
Darin Adler
Comment 17 2019-06-30 13:14:14 PDT
Comment on attachment 373186 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=373186&action=review > Source/WebKit/WebProcess/WebProcess.h:-552 > -#if PLATFORM(COCOA) > enum class ProcessType { Inspector, ServiceWorker, PrewarmedWebContent, CachedWebContent, WebContent }; > ProcessType m_processType { ProcessType::WebContent }; > -#endif What motivates this change? The rest of the m_processType code is inside #if PLATFORM(MAC/COCOA/IOS_FAMILY) conditionals. That includes code in WebProcess functions initializeWebProcess, setIsInProcessCache, and markIsNoLongerPrewarmed. Why the change in strategy only for this newly written code? We could have removed some of those other conditionals too if we are deciding to change our conditionals strategy. Typically I would suggest staying with the #if PLATFORM(COCOA) or remove more of it, not leave it mixed.
Per Arne Vollan
Comment 18 2019-07-01 07:37:34 PDT
(In reply to Darin Adler from comment #17) > Comment on attachment 373186 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=373186&action=review > > > Source/WebKit/WebProcess/WebProcess.h:-552 > > -#if PLATFORM(COCOA) > > enum class ProcessType { Inspector, ServiceWorker, PrewarmedWebContent, CachedWebContent, WebContent }; > > ProcessType m_processType { ProcessType::WebContent }; > > -#endif > > What motivates this change? The rest of the m_processType code is inside #if > PLATFORM(MAC/COCOA/IOS_FAMILY) conditionals. That includes code in > WebProcess functions initializeWebProcess, setIsInProcessCache, and > markIsNoLongerPrewarmed. Why the change in strategy only for this newly > written code? We could have removed some of those other conditionals too if > we are deciding to change our conditionals strategy. > > Typically I would suggest staying with the #if PLATFORM(COCOA) or remove > more of it, not leave it mixed. I will add '#if PLATFORM(COCOA)' back for consistency. I created https://bugs.webkit.org/show_bug.cgi?id=199362 to declare m_processType for all platforms, since I think the related code could be cross platform. Thanks for reviewing!
Per Arne Vollan
Comment 19 2019-07-01 07:42:12 PDT
WebKit Commit Bot
Comment 20 2019-07-01 08:34:22 PDT
Comment on attachment 373234 [details] Patch Clearing flags on attachment: 373234 Committed r247009: <https://trac.webkit.org/changeset/247009>
Note You need to log in before you can comment on or make changes to this bug.