Closed Bug 1756518 Opened 2 years ago Closed 2 years ago

Delay starting the Untrusted Modules thread

Categories

(Core :: DLL Services, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
99 Branch
Tracking Status
firefox99 --- fixed

People

(Reporter: florian, Assigned: toshi)

References

Details

(Keywords: perf:startup)

Attachments

(1 file)

Example startup profile: https://share.firefox.dev/3LOxhu1

The CPU used by the Untrusted Modules thread seems to be competing with the parent process main thread and the privileged content and WebExtension process before startup is done. It's not a problem on my laptop that has many cores, but on machines with few cores, I think we might be delaying the end of startup.

If possible I think it would be good to delay this processing further (could it start from the "browser-startup-idle-tasks-finished" notification for example?), and lower its priority.

This patch is to delay starting UntrustedModulesProcessor to avoid
processing a massive amount of loaded modules in the browser process
during startup.

To achive that, this patch introduces "unblock-untrusted-modules-thread"
notification. Before the notification, UntrustedModulesProcessor is
created but marked as not ready. This means the processor does not
go beyond ScheduleNonEmptyQueueProcessing. Once the notification is
observed, we propagate it to all existing child processes, and afterward
UntrustedModulesProcessor in new processes will be marked ready from
the beginning.

Pushed by tkikuchi@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3336c8e9a43f
Delay starting UntrustedModulesProcessor.  r=mhowell,necko-reviewers,kershaw
Pushed by tkikuchi@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6f9edda31be0
Delay starting UntrustedModulesProcessor.  r=mhowell,necko-reviewers,kershaw
Pushed by tkikuchi@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c63f50d02eac
Delay starting UntrustedModulesProcessor.  r=mhowell,necko-reviewers,kershaw

Backed out for causing bp-hybrid bustage on SocketProcessHost.cpp

[task 2022-03-04T23:30:34.944Z] 23:30:34     INFO -  /builds/worker/checkouts/gecko/netwerk/ipc/SocketProcessHost.cpp(180,10): error: use of undeclared identifier 'DllServices'
[task 2022-03-04T23:30:34.944Z] 23:30:34     INFO -    RefPtr<DllServices> dllSvc(DllServices::Get());
[task 2022-03-04T23:30:34.944Z] 23:30:34     INFO -           ^
[task 2022-03-04T23:30:34.944Z] 23:30:34     INFO -  /builds/worker/checkouts/gecko/netwerk/ipc/SocketProcessHost.cpp(180,30): error: use of undeclared identifier 'DllServices'
[task 2022-03-04T23:30:34.944Z] 23:30:34     INFO -    RefPtr<DllServices> dllSvc(DllServices::Get());
[task 2022-03-04T23:30:34.944Z] 23:30:34     INFO -                               ^
[task 2022-03-04T23:30:34.945Z] 23:30:34     INFO -  /builds/worker/checkouts/gecko/netwerk/ipc/SocketProcessHost.cpp(180,29): error: parentheses were disambiguated as a function declaration [-Werror,-Wvexing-parse]
[task 2022-03-04T23:30:34.945Z] 23:30:34     INFO -    RefPtr<DllServices> dllSvc(DllServices::Get());
[task 2022-03-04T23:30:34.945Z] 23:30:34     INFO -                              ^~~~~~~~~~~~~~~~~~~~
[task 2022-03-04T23:30:34.945Z] 23:30:34     INFO -  /builds/worker/checkouts/gecko/netwerk/ipc/SocketProcessHost.cpp(180,30): note: add a pair of parentheses to declare a variable
[task 2022-03-04T23:30:34.945Z] 23:30:34     INFO -    RefPtr<DllServices> dllSvc(DllServices::Get());
[task 2022-03-04T23:30:34.945Z] 23:30:34     INFO -                               ^
[task 2022-03-04T23:30:34.945Z] 23:30:34     INFO -                               (
[task 2022-03-04T23:30:34.945Z] 23:30:34     INFO -  3 errors generated.
[task 2022-03-04T23:30:34.946Z] 23:30:34    ERROR -  gmake[4]: *** [/builds/worker/checkouts/gecko/config/rules.mk:660: SocketProcessHost.obj] Error 1
Pushed by tkikuchi@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fc528b1586e5
Delay starting UntrustedModulesProcessor.  r=mhowell,necko-reviewers,kershaw
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 99 Branch
Flags: needinfo?(tkikuchi)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: