-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify task queues locking mechanism (#16477)
We now have one mutex guarding all accesses to the underlying task heaps. This simplifies the more granular but bug prone mechanism of having striped locks. This also re-enables GPUThreadMerger tests that are currently disabled due to their flaky nature. The scenario that gets fixed by this change is as follows: 1. Thread-1: We lock `queue_meta_mutex_` and grab locks on `queue_1` and release the meta mutex. 2. Thread-1: We add an Observer on `queues` object. 3. Thread-2: We lock `queue_meta_mutex_` and grab locks on `queue_2`. 4. Thread-2: We try to dispose all the pending tasks on `queue_2` which calls `erase` on `queues`. The above situation is not thread safe without having 1 lock. Note: This increases the contention on one lock and could potentially be bad for perf. We are explicitly making this trade-off towards reducing the complexity. Fixes: flutter/flutter#49007
- Loading branch information
1 parent
c932214
commit 5c70356
Showing
3 changed files
with
28 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters