Closed Bug 944665 Opened 11 years ago Closed 11 years ago

Call preload slow things after preallocated process is forked from Nuwa

Categories

(Core :: IPC, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla29
blocking-b2g 1.3+
Tracking Status
firefox27 --- wontfix
firefox28 --- fixed
firefox29 --- fixed
b2g-v1.3 --- fixed
b2g-v1.3T --- fixed

People

(Reporter: kk1fff, Assigned: kk1fff)

References

Details

(Whiteboard: [qa-])

Attachments

(2 files, 2 obsolete files)

PreloadSlowThings is called before Nuwa freeze now. This function produces many asynchronous messages from parent to frozen Nuwa. For a short term solution, we can move the code of invoking PreloadSlowThings to the new process forked from Nuwa.
Attached patch Proposed Patch (obsolete) (deleted) — Splinter Review
Assignee: nobody → pwang
Attachment #8340316 - Flags: feedback?(cyu)
Comment on attachment 8340316 [details] [diff] [review] Proposed Patch >From 3318c7156999b60f35ec2c6acfedfd10034f279f Mon Sep 17 00:00:00 2001 >From: Patrick Wang <kk1fff@patrickz.net> >Date: Fri, 29 Nov 2013 17:28:54 +0800 >Subject: [PATCH 5/5] Move common initialization routine into a function and > invoke PreloadSlowThings after nuwa forked > >--- > dom/ipc/ContentChild.cpp | 27 ++++--- > dom/ipc/ContentParent.cpp | 188 ++++++++++++++++++++++++--------------------- > dom/ipc/ContentParent.h | 5 ++ > 3 files changed, 122 insertions(+), 98 deletions(-) > >diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp >index fd558e1..b55eb0f 100644 >--- a/dom/ipc/ContentChild.cpp >+++ b/dom/ipc/ContentChild.cpp >@@ -1362,17 +1351,31 @@ ContentChild::RecvAppInfo(const nsCString& version, const nsCString& buildID, > mAppInfo.UAName.Assign(UAName); > // If we're part of the mozbrowser machinery, go ahead and start > // preloading things. We can only do this for mozbrowser because > // PreloadSlowThings() may set the docshell of the first TabChild > // inactive, and we can only safely restore it to active from > // BrowserElementChild.js. > if ((mIsForApp || mIsForBrowser) && > Preferences::GetBool("dom.ipc.processPrelaunch.enabled", false)) { >- PreloadSlowThings(); >+#ifdef MOZ_NUWA_PROCESS >+ if (IsNuwaProcess()) { >+ // Perform GC before freezing the Nuwa process to reduce memory usage. >+ ContentChild::GetSingleton()->RecvGarbageCollect(); >+ >+ MessageLoop::current()-> >+ PostTask(FROM_HERE, >+ NewRunnableFunction(OnFinishNuwaPreparation)); >+ } else { >+ // This is a forked process, do preloading here. >+ PreloadSlowThings(); >+ } >+#else // !MOZ_NUWA_PROCESS >+ PreloadSlowThings(); >+#endif > } > return true; > } > I will prefer if ((mIsForApp || mIsForBrowser) && Preferences::GetBool("dom.ipc.processPrelaunch.enabled", false) #ifdef MOZ_NUWA_PROCESS && !IsNuwaProcess() #endif ) { PreloadSlowThings(); } And also, posting a delayed task should be moved out of the if block.
Attachment #8340316 - Flags: feedback?(cyu)
As discussion on bug 941466, this would be a short term solution to make Nuwa enabled on try server.
Blocks: 930282
blocking-b2g: --- → 1.3?
Attachment #8341013 - Flags: review?(khuey)
Attachment #8341014 - Flags: review?(khuey)
Attachment #8341014 - Attachment is obsolete: true
Attachment #8341014 - Flags: review?(khuey)
Attachment #8341603 - Flags: review?(khuey)
Have we measured how much this increases memory consumption (USS specifically) in the forked processes? Do we have a bug on file on undoing this and fixing it correctly?
Flags: needinfo?(pwang)
I guess those measurements are in bug 941466.
Flags: needinfo?(pwang)
Comment on attachment 8341603 [details] [diff] [review] Part 2: don't call PreloadSlowThings before nuwa fork. Review of attachment 8341603 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/ipc/ContentChild.cpp @@ +1363,5 @@ > PreloadSlowThings(); > } > + > +#ifdef MOZ_NUWA_PROCESS > + if (Preferences::GetBool("dom.ipc.processPrelaunch.enabled", false) && This is nit picky, but I would move this up further and do if (!Preferences::GetBool(...)) { return true; } if ((mIsForApp .... ... #ifdef MOZ_NUWA_PROCESS ...
Attachment #8341603 - Flags: review?(khuey) → review+
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #8) > I guess those measurements are in bug 941466. Yes, they are. And bug 941466 is tracking the work for making the preloading work properly as well.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
Backed out in https://hg.mozilla.org/mozilla-central/rev/06b3a7aea2c0 for frequent (somewhere between 20 and 50%) xpcshell shutdown crashes like https://tbpl.mozilla.org/php/getParsedLog.php?id=31651189&tree=B2g-Inbound
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: mozilla28 → ---
Status: REOPENED → RESOLVED
Closed: 11 years ago11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
1.3+ for rel eng.
blocking-b2g: 1.3? → 1.3+
Whiteboard: [tarako]
Whiteboard: [tarako] → [tarako][qa-]
status-b2g-v1.3T: fixed indicated that its in tarako. remove [tarako] whiteboard
Whiteboard: [tarako][qa-] → [qa-]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: