You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
runtime: simplify mark termination and eliminate mark 2 #26903
The garbage collector currently uses a racy and complex algorithm to enter mark termination, which has wide-ranging consequences for the complexity of the mark termination implementation. I propose replacing it with a race-free distributed termination detection-like algorithm. This should open the door to several significant simplifications of the garbage collector algorithm.
Reacted by Emmanuel T Odeke, Giacomo Tartari, Brian Kemper, Akhil Indurti, Aleksandr Razumov, Rajender Reddy Kompally, Cholerae Hu, melkorm, Konstantin Khomoutov and Changkun Ou
Reacted by Agniva De Sarker, Aleksandr Razumov and melkorm
The only unimplemented step of my original proposal is "Allow safe-points without preemption in dedicated workers". Working on that should probably be folded into a broader re-think of how we schedule and preempt workers.
The primary goal was eliminating mark 2, which is done.
We've known about and worked around a bug in this protocol for several years, which apparently we never referenced from this issue. To save myself time searching GitHub in the future, this is where I described the problem: #27993 (comment)
To be clear, the work-around we have in place works, it's just kind of unfortunate and very occasionally causes an extra STW.
Activity
gopherbot commentedon Aug 9, 2018
Change https://golang.org/cl/128896 mentions this issue:
design: simplify mark termination and eliminate mark 2design: simplify mark termination and eliminate mark 2
gopherbot commentedon Sep 10, 2018
Change https://golang.org/cl/134319 mentions this issue:
runtime: eliminate gcBlackenPromptly modegopherbot commentedon Sep 10, 2018
Change https://golang.org/cl/134317 mentions this issue:
runtime: track whether any buffer has been flushed from gcWorkgopherbot commentedon Sep 10, 2018
Change https://golang.org/cl/134316 mentions this issue:
runtime: remove GODEBUG=gctrace=2 modegopherbot commentedon Sep 10, 2018
Change https://golang.org/cl/134320 mentions this issue:
runtime: don't disable GC work caching during mark terminationgopherbot commentedon Sep 10, 2018
Change https://golang.org/cl/134315 mentions this issue:
runtime: flush write barrier buffer to create workgopherbot commentedon Sep 10, 2018
Change https://golang.org/cl/134318 mentions this issue:
runtime: eliminate mark 2 and fix mark termination racegopherbot commentedon Sep 11, 2018
Change https://golang.org/cl/134778 mentions this issue:
runtime: add a more stable isSystemGoroutine modegopherbot commentedon Sep 11, 2018
Change https://golang.org/cl/134784 mentions this issue:
runtime: eliminate work.markrootdone and second root marking passgopherbot commentedon Sep 11, 2018
Change https://golang.org/cl/134779 mentions this issue:
runtime: support disabling goroutine scheduling by classgopherbot commentedon Sep 11, 2018
Change https://golang.org/cl/134780 mentions this issue:
runtime: implement STW GC in terms of concurrent GC15 remaining items
runtime: remove GODEBUG=gcrescanstacks=1 mode
runtime: add a more stable isSystemGoroutine mode
runtime: support disabling goroutine scheduling by class
runtime: implement STW GC in terms of concurrent GC
runtime: clean up remaining mark work check
runtime: eliminate blocking GC work drains
runtime: flush mcaches lazily
runtime: eliminate work.markrootdone and second root marking pass
runtime: eliminate gchelper mechanism
aclements commentedon Oct 24, 2018
The only unimplemented step of my original proposal is "Allow safe-points without preemption in dedicated workers". Working on that should probably be folded into a broader re-think of how we schedule and preempt workers.
The primary goal was eliminating mark 2, which is done.
aclements commentedon Feb 1, 2023
We've known about and worked around a bug in this protocol for several years, which apparently we never referenced from this issue. To save myself time searching GitHub in the future, this is where I described the problem: #27993 (comment)
To be clear, the work-around we have in place works, it's just kind of unfortunate and very occasionally causes an extra STW.