Closed Bug 870181 Opened 12 years ago Closed 11 years ago

Downgrade processes' CPU priorities when we receive a call

Categories

(Firefox OS Graveyard :: General, defect)

defect
Not set
normal

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+
Tracking Status
firefox21 --- wontfix
firefox22 --- wontfix
firefox23 --- fixed
b2g18 --- fixed
b2g18-v1.0.0 --- wontfix
b2g18-v1.0.1 --- fixed

People

(Reporter: justin.lebar+bug, Assigned: justin.lebar+bug)

References

Details

Attachments

(3 files)

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.
blocking-b2g: --- → tef+
Assignee: nobody → justin.lebar+bug
Whiteboard: [status: has patches (not yet attached), will need reviews]
This patch also makes it an error to call hal::SetProcessPriority from a child process.
Attachment #747241 - 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+
Attachment #747243 - Flags: review?(bent.mozilla) → review+
> 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.
Whiteboard: [status: has patches (not yet attached), will need reviews] → [status: needs uplift]
Can you please provide steps to verify this fix - as we will blackbox test from the UI?
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.

Attachment

General

Created:
Updated:
Size: