Closed Bug 1767875 Opened 2 years ago Closed 2 years ago

TaskController wakes up all threads of its pool when a task is available

Categories

(Core :: XPCOM, defect)

defect

Tracking

()

VERIFIED FIXED
102 Branch
Tracking Status
firefox102 --- fixed

People

(Reporter: florian, Assigned: bas.schouten)

References

(Blocks 1 open bug)

Details

(Keywords: perf:resource-use, power)

Attachments

(1 file)

Example profile: https://share.firefox.dev/3MUAZlR
In this profile the "TaskController #3" thread has a short "Runnable' marker at the same time as the "Awake" marker. All the other TaskController threads have an Awake marker without runnable marker, so I think they woke up pointlessly.

This is probably due to the code at https://searchfox.org/mozilla-central/rev/d989c65584ded72c2de85cb40bede7ac2f176387/xpcom/threads/TaskController.cpp#815-820
It was introduced in bug 1637592 and there was a review comment on this at https://phabricator.services.mozilla.com/D75105#inline-447578 that is marked "Done" but I don't see a reply to it.

FYI, according to the data I started collecting in bug 1763474, "TaskController" threads represent about 0.7% of all thread wakeups, and 1.5% of thread wakeups in background content processes. (dashboard at https://sql.telemetry.mozilla.org/dashboard/cpu-use-on-nightly)

Flags: needinfo?(bas)
Assignee: nobody → bas
Status: NEW → ASSIGNED
Pushed by bschouten@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fdfffc18bd4b
Avoid ever waking up more than one thread at a time. r=smaug
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 102 Branch
Flags: needinfo?(bas)

Verified using Telemetry data.

Before the fix, the Nightly builds built on Tuesdays (builds receiving the most use as users have time to update to them and use them during week days) reported about 14 billion wake-ups of taskcontroller threads; after the fix, this is down to 9-11 billion wake-ups.

The builds built on Saturdays (these receive the least use as the usage during the week-end is lower, and people coming back to their computers on Mondays either update to a build from Sunday or from the same Monday) reported about 10-11 billion taskcontroller thread wake-ups before the fix, and down to 8-9 billion wake-ups after the fix.

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: