On 02/04/2014 02:09, Jonas Sicking wrote: > I think it'd make a lot of sense to make the app have high priority > while it's launching, both CPU-wise and out-of-memory-wise.
Good point, we already have a mechanism to do that but it would be interesting to gauge it's speed: grabbing the wake-lock pushes a process into the FOREGROUND_HIGH high-priority mode that makes it almost invulnerable to the LMK and gives it the lowest nice value. > If I recall correctly it's already Gaia's responsibility to indicate > through the browser API which application is the foreground app. So if > it could just make that indication immediately we should be able to > wire up the Gecko bits so that the app process gets the right priority > right away. Currently this is done via an observer: http://hg.mozilla.org/mozilla-central/file/4941a2ac0786/dom/ipc/ProcessPriorityManager.cpp#l686 Note that in the case of "audio-channel-process-changed", "remote-browser-shown" and "ipc:browser-destroyed" changes we don't adjust the process priority right away. We delay it by a second if we're sending a process in the background and by 5 seconds if the said process is perceivable (i.e. it's playing audio). The only case in which we immediately change priority is for "frameloader-visible-changed" events and in response to a wake-lock change. I'm not sure if the former is what's being triggered when a new application becomes visible but we could certainly be more aggressive with it provided we don't introduce regressions. The reason we're delaying priority changes in some scenarios is to prevent abrupt low-high-low priority transitions which might cause applications to be killed during fast switching and other similar racy behaviors. One thing we haven't done in a while is measuring how long it takes from when we do a change in gaia to when the change is reflected in the process priority. I'll try to take some measures today so we know if there's some low-hanging fruit to pick there. Gabriele
signature.asc
Description: OpenPGP digital signature
_______________________________________________ dev-b2g mailing list [email protected] https://lists.mozilla.org/listinfo/dev-b2g
