Closed Bug 1686222 Opened 4 years ago Closed 4 years ago

Task submitted to TaskController takes a while to be executed

Categories

(Core :: XPCOM, task)

task

Tracking

()

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: allstars.chh, Assigned: bas.schouten)

References

Details

(Keywords: perf-alert)

Attachments

(1 file)

There's a similar bug 1685727 but I think this is a different problem so filing another bug for this.
After calling TaskController::AddTask, I found the task isn't executed by other threads, and the reason is that most threads are in the waiting state of mThreadPoolCV.
https://searchfox.org/mozilla-central/rev/31ddf859c57e812878a5f817e4097efb06de4d97/xpcom/threads/TaskController.cpp#301

The mThreadPoolCV can be only notified in TaskController::ShutdownThreadPoolInternal
https://searchfox.org/mozilla-central/rev/31ddf859c57e812878a5f817e4097efb06de4d97/xpcom/threads/TaskController.cpp#177
or
TaskController::ProcessPendingMTTask

For a mozilla::Task with mMainThreadOnly is false, does it make sense to do mThreadPoolCV.NotifyAll() when we call AddTask()?

I tried this and it seems working (Task gets executed because other threads have been notified).

Hi Bas, can you help to clarify this? Or if we shouldn't do the mThreadPoolCV.NofityAll() in AddTask(), can you explain the reason? Or, can you suggest what should I do to make the Task gets executed earlier?

Thanks

Flags: needinfo?(bas)

ping Bas and he says this is definitely a bug.

Assignee: nobody → allstars.chh
Flags: needinfo?(bas)

Good catch. This seems like there's a problem. Posted a patch, could you confirm this addresses your issue as well?

Pushed by bschouten@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/94554fb57bf4 Ensure proper thread is woken up when a new task is posted. r=smaug
Assignee: allstars.chh → bas
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 86 Branch

== Change summary for alert #28528 (as of Mon, 25 Jan 2021 08:27:12 GMT) ==

Improvements:

Ratio Suite Test Platform Options Absolute values (old vs new)
31% pinterest SpeedIndex linux64-shippable nocondprof warm 525.58 -> 362.58
29% pinterest PerceptualSpeedIndex linux64-shippable nocondprof warm 518.92 -> 367.00
25% pinterest SpeedIndex linux64-shippable-qr nocondprof warm webrender 498.21 -> 372.67
25% instagram ContentfulSpeedIndex macosx1014-64-shippable-qr nocondprof warm webrender 525.17 -> 393.33
24% pinterest PerceptualSpeedIndex linux64-shippable-qr nocondprof warm webrender 493.42 -> 376.08
21% pinterest SpeedIndex linux64-shippable-qr nocondprof warm webrender 485.21 -> 384.25
17% imdb ContentfulSpeedIndex android-hw-p2-8-0-android-aarch64-shippable nocondprof warm webrender 1,287.50 -> 1,065.67
16% imdb SpeedIndex android-hw-p2-8-0-android-aarch64-shippable nocondprof warm webrender 1,157.04 -> 975.08
10% pinterest ContentfulSpeedIndex linux64-shippable nocondprof warm 313.83 -> 281.67
10% youtube ContentfulSpeedIndex macosx1014-64-shippable-qr nocondprof warm webrender 1,223.58 -> 1,102.33
8% allrecipes ContentfulSpeedIndex android-hw-p2-8-0-android-aarch64-shippable nocondprof warm 645.50 -> 594.00
6% youtube ContentfulSpeedIndex macosx1014-64-shippable-qr cold nocondprof webrender 2,036.92 -> 1,922.08
6% microsoft-support LastVisualChange android-hw-g5-7-0-arm7-api-16-shippable nocondprof warm 2,275.21 -> 2,147.75

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=28528

Keywords: perf-alert
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: