Skip to content

runtime: simplify mark termination and eliminate mark 2 #26903

Closed

Description

@aclements

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.

The design doc can be viewed here.

/cc @RLH

Activity

  1. added this to the Go1.12 milestone on Aug 9, 2018
  2. self-assigned this
    on Aug 9, 2018
  3. gopherbot commented on Aug 9, 2018

    @gopherbot
    Contributor

    Change https://golang.org/cl/128896 mentions this issue: design: simplify mark termination and eliminate mark 2

  4. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Aug 10, 2018
  5. gopherbot commented on Sep 10, 2018

    @gopherbot
    Contributor

    Change https://golang.org/cl/134319 mentions this issue: runtime: eliminate gcBlackenPromptly mode

  6. gopherbot commented on Sep 10, 2018

    @gopherbot
    Contributor

    Change https://golang.org/cl/134317 mentions this issue: runtime: track whether any buffer has been flushed from gcWork

  7. gopherbot commented on Sep 10, 2018

    @gopherbot
    Contributor

    Change https://golang.org/cl/134316 mentions this issue: runtime: remove GODEBUG=gctrace=2 mode

  8. gopherbot commented on Sep 10, 2018

    @gopherbot
    Contributor

    Change https://golang.org/cl/134320 mentions this issue: runtime: don't disable GC work caching during mark termination

  9. gopherbot commented on Sep 10, 2018

    @gopherbot
    Contributor

    Change https://golang.org/cl/134315 mentions this issue: runtime: flush write barrier buffer to create work

  10. gopherbot commented on Sep 10, 2018

    @gopherbot
    Contributor

    Change https://golang.org/cl/134318 mentions this issue: runtime: eliminate mark 2 and fix mark termination race

  11. gopherbot commented on Sep 11, 2018

    @gopherbot
    Contributor

    Change https://golang.org/cl/134778 mentions this issue: runtime: add a more stable isSystemGoroutine mode

  12. gopherbot commented on Sep 11, 2018

    @gopherbot
    Contributor

    Change https://golang.org/cl/134784 mentions this issue: runtime: eliminate work.markrootdone and second root marking pass

  13. gopherbot commented on Sep 11, 2018

    @gopherbot
    Contributor

    Change https://golang.org/cl/134779 mentions this issue: runtime: support disabling goroutine scheduling by class

  14. gopherbot commented on Sep 11, 2018

    @gopherbot
    Contributor

    Change https://golang.org/cl/134780 mentions this issue: runtime: implement STW GC in terms of concurrent GC

  15. 15 remaining items

  16. aclements commented on Oct 24, 2018

    @aclements
    MemberAuthor

    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.

  17. locked and limited conversation to collaborators on Oct 24, 2019
  18. aclements commented on Feb 1, 2023

    @aclements
    MemberAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions