Open Bug 1897074 Opened 1 year ago Updated 1 year ago

nsThreadPool: Avoid work stealing by assigning events when notifying

Categories

(Core :: XPCOM, enhancement, P5)

enhancement

Tracking

()

People

(Reporter: jstutte, Unassigned)

References

(Blocks 2 open bugs)

Details

Under certain loads, a non-trivial amount of incoming events is not handled by the thread we actually notify during PutEvent but stolen by some other thread that just finished working on another event and got the lock on the common mutex prior to the notified thread. This makes the assignment of events to threads less predictable as it could be.

When PutEvent decides to notify an idle thread, it could just "pass" the event to that thread without even adding it to the queue. We could use the MRUIdleEntry struct introduced by bug 1891664 for this event passing.

In the case of creating a new thread, we could pass the initial event through an extra runnable that wraps nsThreadPool::Run or something similar to make that assignment explicit, too.

No longer blocks: 1897072
Blocks: 1897072
Depends on: 1891664
Blocks: 1897078
See Also: → 1895438
Severity: -- → S4
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.