Closed Bug 1853400 Opened 2 years ago Closed 1 year ago

Consider releasing the helper thread lock before calling the task dispatch callback

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

RESOLVED FIXED
127 Branch
Tracking Status
firefox127 --- fixed

People

(Reporter: jandem, Assigned: jonco)

References

(Blocks 1 open bug)

Details

(Whiteboard: [sp3])

Attachments

(2 files)

I noticed in a profile that the browser's DispatchOffThreadTask can be fairly slow because it does task controller lock/malloc stuff. We currently call this callback with the helper thread lock held; if possible we should consider unlocking to unblock other threads.

We do need the lock for the internal thread pool dispatch, but we could either make it conditional or lock inside the internal thread pool's dispatch callback.

Whiteboard: [sp3]
Severity: -- → N/A
Priority: -- → P2

This changes UnlockGuard to work with anything that supplies lock and unlock
methods so that it can be used with subclasses of LockGaurd that do extra work
in these methods.

The unused AutoUnlockMonitor is removed.

Assignee: nobody → jcoppeard
Status: NEW → ASSIGNED

This works by keeping a count of tasks to dispatch on AutoLockHelperThreadState
which are handled when it is unlocked. One issue is that we must take care not
to wait for a helper task to complete before we've had a chance to displach the
task we're going to wait on.

Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/167f127cbbca Part 1: Simplify UnlockGuard and make it more generic r=jandem https://hg.mozilla.org/integration/autoland/rev/b0664939a81e Part 2: Don't call the helper thread task dispatch callback with the helper thread lock held r=jandem
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 127 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: