Closed Bug 1713335 Opened 3 years ago Closed 3 years ago

Dispatch helper tasks to an external thread pool if one is supplied

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

Details

Attachments

(8 files)

The plan is to make this work as closely as possible to the way the current helper thread system works.

The previous patch added a pref to control use of the external thread pool. I
don't think we need an environment variable as well, although I could be
persuaded to keep this.

Depends on D116812

This is a stronger condition because we assert CanUseExtraThreads during
initialization. It's also closer to to the original intent.

Depends on D116813

I missed this when moving findHighestPriorityTask out of HelperThread previously.

Depends on D116814

Tasks are dispatched by queueing a generic task for the pool. When this is
executed it will run the highest priority task pending, if any.

In a busy system it's possible that there will be some delay between
dispatching this task and it starting running. There is also a limit on the
number of tasks that are run at once for each task kind. The patch therefore
limits the number of tasks dispatched to the number of avilable threads.

Depends on D116816

This also renames the waitForAllThreads method to the more accurate waitForAllTasks.

Depends on D117004

This allows any external tasks that happen to run after the helper thread
system has shut down to correctly detect that. This shouldn't happen with the
next patch but it seems safer to do it this way.

Blocks: 1714141
Depends on: 1713287
Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/77a4909e2915 Add a pref to control use of XPCOM thread pool, default off r=KrisWright https://hg.mozilla.org/integration/autoland/rev/321c6ab4a6a9 Rely on the embedding to chose whether to use an external pool r=sfink https://hg.mozilla.org/integration/autoland/rev/fbc9b15ecc8f Use HelperThreadState::isInitialized instead of CanUseExtraThreads in a few places r=sfink https://hg.mozilla.org/integration/autoland/rev/1fe10e461405 Tidy GlobalHelperThreadState::findHighestPriorityTask to use this rather than the global r=sfink https://hg.mozilla.org/integration/autoland/rev/996dad41f69b Split out methods to check whether there any tasks we can run of each kind r=sfink https://hg.mozilla.org/integration/autoland/rev/b6e426c592ae Dispatch tasks to external thread pool if present r=sfink https://hg.mozilla.org/integration/autoland/rev/81b9dab609f6 Shutdown helper thread system with lock held r=sfink https://hg.mozilla.org/integration/autoland/rev/241321e38305 Wait for all pending tasks to run when shutting down r=sfink
Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1184c5a4b2e8 Add a pref to control use of XPCOM thread pool, default off r=KrisWright https://hg.mozilla.org/integration/autoland/rev/b9b2e74e7530 Rely on the embedding to chose whether to use an external pool r=sfink https://hg.mozilla.org/integration/autoland/rev/5a395f40ac52 Use HelperThreadState::isInitialized instead of CanUseExtraThreads in a few places r=sfink https://hg.mozilla.org/integration/autoland/rev/18e3f8bf6404 Tidy GlobalHelperThreadState::findHighestPriorityTask to use this rather than the global r=sfink https://hg.mozilla.org/integration/autoland/rev/9c68d8591ef3 Split out methods to check whether there any tasks we can run of each kind r=sfink https://hg.mozilla.org/integration/autoland/rev/21a7a9dbf79d Dispatch tasks to external thread pool if present r=sfink https://hg.mozilla.org/integration/autoland/rev/a460cd7e818d Shutdown helper thread system with lock held r=sfink https://hg.mozilla.org/integration/autoland/rev/85042c2c36ba Wait for all pending tasks to run when shutting down r=sfink
Flags: needinfo?(jcoppeard)
Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d51dcc6a24db Add a pref to control use of XPCOM thread pool, default off r=KrisWright https://hg.mozilla.org/integration/autoland/rev/adc6a4a58aad Rely on the embedding to chose whether to use an external pool r=sfink https://hg.mozilla.org/integration/autoland/rev/a10d0b84ea40 Use HelperThreadState::isInitialized instead of CanUseExtraThreads in a few places r=sfink https://hg.mozilla.org/integration/autoland/rev/0fe894ecc8a9 Tidy GlobalHelperThreadState::findHighestPriorityTask to use this rather than the global r=sfink https://hg.mozilla.org/integration/autoland/rev/91b32f604312 Split out methods to check whether there any tasks we can run of each kind r=sfink https://hg.mozilla.org/integration/autoland/rev/b9ddcd04f43d Dispatch tasks to external thread pool if present r=sfink https://hg.mozilla.org/integration/autoland/rev/63c15ae1b2fd Shutdown helper thread system with lock held r=sfink https://hg.mozilla.org/integration/autoland/rev/1d9496c8460a Wait for all pending tasks to run when shutting down r=sfink
Flags: needinfo?(jcoppeard)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: