Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime/trace: preempted background mark worker is started with GoStart, not GoStartLabel #59325

Closed
dominikh opened this issue Mar 30, 2023 · 2 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@dominikh
Copy link
Member

Normally when a runtime.gcBgMarkWorker goroutine starts running, it is started with GoStartLabel, which allows differentiating between dedicated and idle workers:

36951793 GoBlock p=14 g=13 off=257842
36954632 GoStartLabel p=15 g=13 off=11040855 g=13 seq=5 labelid=2 label=GC (dedicated)

However, when such a goroutine was preempted before it starts running again, GoStart is used:

364170789 GoPreempt p=4 g=13 off=222
364173647 GoStart p=4 g=13 off=227 g=13 seq=0

The trace consumer can work around this, but more consistency would be nice, if it isn't too difficult.

/cc @mknyszek

@dominikh dominikh added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Mar 30, 2023
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Mar 30, 2023
@mknyszek mknyszek self-assigned this Apr 5, 2023
@mknyszek mknyszek added this to the Backlog milestone Apr 5, 2023
@mknyszek
Copy link
Contributor

I'll keep this in mind when working on #60773.

@mknyszek mknyszek modified the milestones: Backlog, Go1.22 Jun 16, 2023
@mknyszek
Copy link
Contributor

I'm pretty sure this is a consequence of the GoStartLocal event path which doesn't re-emit the label. This is indeed fixed in the new tracer, because the GoStartLocal optimization doesn't exist anymore (for better or for worse). It doesn't show up as GoStartLocal because the old trace parser rewrites all GoStartLocal events as GoStart events.

Unfortunately this isn't a super simple fix in the old tracer. Either we always emit GoStart for this case or we change the format of GoStartLocal. The former is certainly the easier one, but I'm inclined to just not fix it. Please comment if you disagree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

3 participants