Closed Bug 957509 Opened 11 years ago Closed 8 years ago

Reduce USS of Nuwa and preallocated process

Categories

(Core :: DOM: Content Processes, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX
blocking-b2g -

People

(Reporter: sinker, Assigned: cyu)

References

Details

(Whiteboard: [~2MB][demo])

Attachments

(2 files, 2 obsolete files)

We found some IPC messages are redundant and increase memory usage (USS) for both Nuwa and preallocated memory. It is ~4MB for both processes. Some studies of Cervantes show that we could drop USS to 1.7MB and 8xxKB respective.
To be more specific, some messages in ContentParent::InitInternal() are redundant for processes forked from Nuwa. Also ProcessPriorityManager should bypass the preallocated process for minimizing memory to avoid touching COW pages.
Cervantes, can you also check if the memory reported for xpti-working-set is actually shared? It really should as it's static tables used by xpconnect.
AFAIK, xpti is loaded by Nuwa process and shared among content processes. It is first thing being aware for Nuwa. Please check https://bugzilla.mozilla.org/show_bug.cgi?id=799658#c35
The main reason the preallocated process has about 3MB of USS is GC and CC. Before the above patch, when b2g is launched (this test is done on unagi using the latest m-c): APPLICATION PID Vss Rss Pss Uss cmdline b2g 22888 78072K 68076K 55297K 49888K /system/b2g/b2g Homescreen 23347 34604K 29956K 15880K 12256K /system/b2g/plugin-container Usage 23285 27864K 25096K 11444K 8156K /system/b2g/plugin-container (Nuwa) 22977 26320K 26320K 10513K 4380K /system/b2g/plugin-container Built-in Keyboa 23425 22308K 22308K 9299K 6296K /system/b2g/plugin-container (Preallocated a 23520 14820K 14820K 5325K 2936K /system/b2g/plugin-container ------ ------ ------ 119308K 94116K TOTAL After avoiding GC and CC for the preallocated process: APPLICATION PID Vss Rss Pss Uss cmdline b2g 26970 76232K 66236K 53459K 47984K /system/b2g/b2g Homescreen 27452 27440K 27436K 13410K 9768K /system/b2g/plugin-container Usage 27381 24236K 24236K 10629K 7308K /system/b2g/plugin-container (Nuwa) 27054 26312K 26312K 9266K 1832K /system/b2g/plugin-container Built-in Keyboa 27521 22040K 22040K 9051K 6004K /system/b2g/plugin-container (Preallocated a 27615 14188K 14188K 4332K 868K /system/b2g/plugin-container ------ ------ ------ 111693K 83964K TOTAL
Please scratch comment #5. The result is with 3 changes applied: 1. PreloadSlowThings() in the Nuwa process, with the risk that the Nuwa process might freeze. 2. Don't reduce redundancies in ContentParent::InitInternal(). 3. Don't GC and CC the preallocated process. I am trying to find out a safe way to reduce RSS of the preallocated process.
The rollup patch that includes the following: 1. Don't GC and CC the preallocated process. 2. Remove redundant IPC messages sent to the preallocated process in ContentParent::InitInternal(). 3. The patches from bug 941466. PreloadSlowThings() are split into 2 parts. We perform the 1st part in the Nuwa process, but we don't do the 2nd part in the preallocated process.
Attachment #8357687 - Attachment is obsolete: true
b2g-procrank with the patch applied: APPLICATION PID Vss Rss Pss Uss cmdline b2g 8904 78164K 68168K 55968K 50528K /system/b2g/b2g Homescreen 9196 33604K 28956K 15285K 11508K /system/b2g/plugin-container Usage 9128 28136K 25368K 12005K 8468K /system/b2g/plugin-container Built-in Keyboa 9312 22932K 22932K 10127K 6864K /system/b2g/plugin-container (Nuwa) 8988 23956K 23952K 8644K 1600K /system/b2g/plugin-container (Preallocated a 9536 12440K 12436K 3794K 440K /system/b2g/plugin-container ------ ------ ------ 116485K 89448K TOTAL b2g-procrank without the patch applied: APPLICATION PID Vss Rss Pss Uss cmdline b2g 26028 77216K 67220K 54830K 49816K /system/b2g/b2g Homescreen 26302 34724K 30076K 16253K 12656K /system/b2g/plugin-container Usage 26229 28596K 25828K 12345K 9036K /system/b2g/plugin-container Built-in Keyboa 26423 22932K 22932K 9974K 6932K /system/b2g/plugin-container (Nuwa) 26111 20520K 20520K 8391K 3836K /system/b2g/plugin-container (Preallocated a 26635 19032K 19032K 7327K 4620K /system/b2g/plugin-container ------ ------ ------ 119332K 96544K TOTAL
Whiteboard: [tarako]
Whiteboard: [tarako] → [tarako][~2MB]
Cervantes, is there something blocking progress here?
Flags: needinfo?(cyu)
This bug depends on bug 941466. We need to land 941466 before this bug. The patch in this bug just removes the 2nd PreloadSlowThings2() and some other IPC messages that are not necessary.
Depends on: 941466
Flags: needinfo?(cyu)
Blocks: 959966
triage: 1.3T+
blocking-b2g: --- → 1.3T+
Whiteboard: [tarako][~2MB] → [~2MB]
This patch will cause bug, the prompt window can't be opened. For example, you can't see the prompt window when you want to delete video in video apps. Please update this patch.
Flags: needinfo?(cyu)
This patch includes work from bug 941466, which breaks the prompt service. I will remove the problematic part and update the patch.
Flags: needinfo?(cyu)
Assignee: nobody → cyu
Attachment #8357720 - Attachment is obsolete: true
The new patch is based on the work in bug 963477.
This removes most IPC messages from ContentParent::InitInternal() that are already done in the Nuwa process. Please note that this will not preload slow things in so USS will increase in the content process. We need to preload partially in the Nuwa process to share more memory (bug 941466).
Whiteboard: [~2MB] → [~2MB][demo]
Depends on: 963477
Run monkey test over 24 hours, maybe this patch cause a bug. You can see two Preallocated process but no homescreen process. SPREADTRUM\james.zhang@jameszhangubtpc:~$ adb shell b2g-procrank APPLICATION PID Vss Rss Pss Uss cmdline b2g 82 43000K 40764K 34983K 31116K /system/b2g/b2g Usage 27282 18104K 18104K 12328K 8548K /system/b2g/plugin-container (Preallocated a 26839 13532K 13528K 10733K 9516K /system/b2g/plugin-container (Nuwa) 343 4548K 4548K 1638K 236K /system/b2g/plugin-container (Preallocated a 14436 1256K 1256K 586K 392K /system/b2g/plugin-container
NI :cyu to help with comment #18 and see if patch needs to be further modified.
Flags: needinfo?(cyu)
I think this is another issue. James, do you have the parent pid of the 2 preallocated proceses?
Flags: needinfo?(cyu) → needinfo?(james.zhang)
(In reply to Cervantes Yu from comment #20) > I think this is another issue. James, do you have the parent pid of the 2 > preallocated proceses? After tarako patch upgrade, we can't catch this issue again.
Flags: needinfo?(james.zhang)
per comment 21, let's close this bug as wfm until it is reproduced again. thanks
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
(In reply to Joe Cheng [:jcheng] from comment #22) > per comment 21, let's close this bug as wfm until it is reproduced again. > thanks This bug is not tracking problem that mentioned in comment 18. We still need this bug to track reducing USS of preallocated and nuwa.
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Component: General → IPC
Product: Firefox OS → Core
sound like a meta bug? 1.3T? so it goes back to triage
blocking-b2g: 1.3T+ → 1.3T?
(In reply to Joe Cheng [:jcheng] from comment #24) > sound like a meta bug? > 1.3T? so it goes back to triage PLease nominate the needed dependencies if needed here, blocking minus on the meta bug.
blocking-b2g: 1.3T? → -
(In reply to Joe Cheng [:jcheng] from comment #24) > sound like a meta bug? > 1.3T? so it goes back to triage What does 'meta bug' mean?
(In reply to James Zhang from comment #26) > (In reply to Joe Cheng [:jcheng] from comment #24) > > sound like a meta bug? > > 1.3T? so it goes back to triage > > What does 'meta bug' mean? A meta bug is used only to track dependencies, and there is usually no patch in meta bugs. Also, we have a convention to not block on meta bugs, but to block on all the dependencies.
Get it, so I can't set v1.3T flag to this meta but I can set this flag to bug which depends on meta bug.
Depends on: 977026
Bug 977026 cuts 1.9MB of USS of the Nuwa by sharing relocation table with the b2g process.
Component: IPC → DOM: Content Processes
Nuwa is gone after bug 1284674.
Status: REOPENED → RESOLVED
Closed: 11 years ago8 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: