Closed
Bug 870181
Opened 12 years ago
Closed 12 years ago
Downgrade processes' CPU priorities when we receive a call
Categories
(Firefox OS Graveyard :: General, defect)
Firefox OS Graveyard
General
Tracking
(blocking-b2g:tef+, firefox21 wontfix, firefox22 wontfix, firefox23 fixed, b2g18 fixed, b2g18-v1.0.0 wontfix, b2g18-v1.0.1 fixed)
RESOLVED
FIXED
blocking-b2g | tef+ |
People
(Reporter: justin.lebar+bug, Assigned: justin.lebar+bug)
References
Details
Attachments
(3 files)
20.77 KB,
patch
|
bent.mozilla
:
review+
|
Details | Diff | Splinter Review |
12.64 KB,
patch
|
bent.mozilla
:
review+
|
Details | Diff | Splinter Review |
9.60 KB,
patch
|
bent.mozilla
:
review+
|
Details | Diff | Splinter Review |
We've determined that it's helpful for some of the testcases in bug 847592 if we lower other processes' CPU priorities when we receive a call. I have patches to do this.
Assignee | ||
Updated•12 years ago
|
blocking-b2g: --- → tef+
Assignee | ||
Updated•12 years ago
|
Assignee: nobody → justin.lebar+bug
Updated•12 years ago
|
Whiteboard: [status: has patches (not yet attached), will need reviews]
Assignee | ||
Comment 1•12 years ago
|
||
This patch also makes it an error to call hal::SetProcessPriority from a child process.
Attachment #747241 -
Flags: review?(bent.mozilla)
Assignee | ||
Comment 2•12 years ago
|
||
Attachment #747242 -
Flags: review?(bent.mozilla)
Assignee | ||
Comment 3•12 years ago
|
||
Attachment #747243 -
Flags: review?(bent.mozilla)
Comment on attachment 747241 [details] [diff] [review]
Part 1: Add an additional LowCPUPriority argument to hal::SetProcessPriority.
Review of attachment 747241 [details] [diff] [review]:
-----------------------------------------------------------------
Ok.
::: hal/Hal.cpp
@@ +877,5 @@
> + switch (aPriority) {
> + case PROCESS_PRIORITY_MASTER:
> + if (aCPUPriority == PROCESS_CPU_PRIORITY_NORMAL) {
> + return "MASTER:CPU_NORMAL";
> + } else if (aCPUPriority == PROCESS_CPU_PRIORITY_LOW) {
Nit: Lots of else-after-return here.
::: hal/Hal.h
@@ +473,5 @@
> + * Set the priority of the given process. A process's priority is a two-tuple
> + * consisting of a hal::ProcessPriority value and a hal::ProcessCPUPriority
> + * value.
> + *
> + * Two processes with the same PrrocessCPUPriority value don't necessarily have
Nit: "PrrocessCPUPriority" typo
Attachment #747241 -
Flags: review?(bent.mozilla) → review+
Comment on attachment 747242 [details] [diff] [review]
Part 2: Lower CPU priority for non-high priority processes when there's an incoming call.
Review of attachment 747242 [details] [diff] [review]:
-----------------------------------------------------------------
This looks fine but if there's an easier/better way to handle the following I'd prefer it...
::: dom/ipc/ProcessPriorityManager.cpp
@@ +51,5 @@
> // priority manager.
> //
> // (Wow, our logging story is a huge mess.)
>
> +#define ENABLE_LOGGING 1
Revert this before checkin.
@@ +955,5 @@
> + ProcessPriorityToString(mPriority, mCPUPriority));
> +
> + if (oldPriority != mPriority) {
> + ProcessPriorityManagerImpl::GetSingleton()->
> + NotifyProcessPriorityChanged(this, oldPriority);
So, the way I read this, we're going to have the following call chain (assuming all the right conditions are met):
1. Call NotifyProcessPriorityChanged
2. NotifyProcessPriorityChanged collects all the ParticularProcessPriorityManagers and for each:
3. Call ResetCPUPriorityNow
4. Call SetPriorityNow (the single arg overload)
5. Call ComputeCPUPriority
6. Call OtherProcessHasHighPriority
7. OtherProcessHasHighPriority collects all ParticularProcessPriorityManagers again
That's a lot of hash enumeration every time a process starts or stops. Shouldn't there be a better way to do this?
Attachment #747242 -
Flags: review?(bent.mozilla) → review+
Updated•12 years ago
|
Attachment #747243 -
Flags: review?(bent.mozilla) → review+
Assignee | ||
Comment 6•12 years ago
|
||
> That's a lot of hash enumeration every time a process starts or stops. Shouldn't there be a better
> way to do this?
I feel like this is a premature optimization; a process starting or stopping is an expensive event. At most we can have what, twenty apps running? So we're talking 400 iterations of a loop.
But I'll see if I can improve this so it's not O(n^2) without adding complex invariants.
Assignee | ||
Comment 7•12 years ago
|
||
I added a hashtable for the high-priority processes. It's better; you were right. Thanks, bent. :)
https://hg.mozilla.org/projects/birch/rev/2c50a1950fd8
https://hg.mozilla.org/projects/birch/rev/6c53b7ecb2ee
https://hg.mozilla.org/projects/birch/rev/1fb1b2e7660f
Updated•12 years ago
|
Whiteboard: [status: has patches (not yet attached), will need reviews] → [status: needs uplift]
Comment 8•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/2c50a1950fd8
https://hg.mozilla.org/mozilla-central/rev/6c53b7ecb2ee
https://hg.mozilla.org/mozilla-central/rev/1fb1b2e7660f
Status: NEW → RESOLVED
Closed: 12 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Comment 9•12 years ago
|
||
https://hg.mozilla.org/releases/mozilla-b2g18/rev/31244fd39afc
https://hg.mozilla.org/releases/mozilla-b2g18/rev/6aba0ca00f62
https://hg.mozilla.org/releases/mozilla-b2g18/rev/75f8fd838132
https://hg.mozilla.org/releases/mozilla-b2g18_v1_0_1/rev/a53ff6157699
https://hg.mozilla.org/releases/mozilla-b2g18_v1_0_1/rev/68fdd8a0a9e1
https://hg.mozilla.org/releases/mozilla-b2g18_v1_0_1/rev/a566b3cf2687
status-b2g18:
--- → fixed
status-b2g18-v1.0.0:
--- → wontfix
status-b2g18-v1.0.1:
--- → fixed
status-firefox21:
--- → wontfix
status-firefox22:
--- → wontfix
status-firefox23:
--- → fixed
Whiteboard: [status: needs uplift]
Comment 10•12 years ago
|
||
Can you please provide steps to verify this fix - as we will blackbox test from the UI?
Comment 11•11 years ago
|
||
Can you please provide steps to verify this fix - as we will blackbox test from the UI?
You need to log in
before you can comment on or make changes to this bug.
Description
•