Randomly distribute small stacks when donating parallel marking work
Categories
(Core :: JavaScript: GC, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox137 | --- | fixed |
People
(Reporter: jonco, Assigned: jonco)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
One potential concern about parallel marking is that the number of donations (where work is transferred between marking threads) can be large for some workloads. What I think happens is that we get into a state where the work donated is marked very quickly which causes to receiving thread to almost immediately request more work, interrupting the thread that is actually making progress. This state depends on the workload and on the layout of work on the mark stack itself.
This could result in reduced marking performance, particularly if the system is busy and other threads are competing for CPU time or the system is one where inter-thread communication has higher overhead.
Current telemetry indicates that although the median number of donations is 18 in a GC slice, the 99th percentile is around 480.
To address this I've been experimenting with randomly distributing mark stack entries between two threads when donating small amounts of work (currently we donate the top half of the stack in one block). This has shown a significant reduction in the number of donations (by up to 30% on some benchmarks), as well as large reduction in the variance of the number of donations. This did not result in any change in performance, or any significant increase in time spent donating work.
| Assignee | ||
Comment 1•11 months ago
|
||
Updated•11 months ago
|
| Assignee | ||
Comment 2•11 months ago
|
||
Comment 4•11 months ago
|
||
| bugherder | ||
| Assignee | ||
Comment 5•11 months ago
|
||
Telemetry shows this was an improvement.
Median parallel marking interruptions we reduced by 8% and by 32% at the 95th percentile.
This lead to in increase in median mark rate by 3.5% and by 7% at the 5th percentile.
Median mark time and GC time are showing a 5% improvement, but that is within the margin of error.
https://docs.google.com/spreadsheets/d/1an9OhPlAIFYIgb0F2BnG8DC0Yh0TsEH7NTb16ekdt0k/edit?usp=sharing
Description
•