Put all XPCOM threads in the background in background browsing contexts
Categories
(Core :: XPCOM, enhancement)
Tracking
()
People
(Reporter: KrisWright, Unassigned)
References
Details
Attachments
(1 file)
In bug 1805932 we put the main thread in the background. This bug tracks the process of putting other XPCOM threads in the background as well. This process will undoubtedly be a lot more complicated, as we need to go through our nsThread infrastructure to make threads and thread pools aware of their status in the background without causing spurious wakeups, and likewise when reentering the foreground. This runs the potential of giving us additional power savings on Apple Silicon.
Reporter | ||
Comment 1•2 years ago
|
||
This part is especially tricky and what exists here so far is what I am using to test the behavior. Notifying the threads that they need to go into the background is where the main hangup is - preventing spurious wakeups while also noticing the change. To solve this I am dealing with a global background value which threads can check during dispatch. If they notice there has been a measurable change, they can dispatch to their own event target first a method to set themselves into the background. I haven't worked out yet how we'll be notifying the mechanism of the changes.
Comment 2•9 months ago
|
||
Here is a power profile I captured yesterday: https://share.firefox.dev/3wqlKyj
The content process is in the background priority. Despite a lot of CPU activity in the main thread (long GC), the power use of the process is limited (the power is < 200mW most of the time), however, the power use increases dramatically as soon as there's some activity in the DOM Worker thread, using more than 3W.
Kris, what's the current plan to fix this bug? If getting a solution that works for all threads is tricky, would it make sense to address first the DOM Worker threads (ie. the threads the web page can control)?
Reporter | ||
Comment 3•9 months ago
|
||
Currently no decision has been made about offthread work in background tabs - we may be able to investigate lowering the priority of particular threads for heuristic improvements. Currently I haven't been doing any work on this - the main thread experiment is ongoing ATM.
Description
•