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: a useless GC mode(gcForceMode) #19609

Closed
zhaozhiqianghw opened this issue Mar 19, 2017 · 3 comments

Comments

Projects
None yet
5 participants
@zhaozhiqianghw
Copy link

commented Mar 19, 2017

GC has three mode: gcBackgroundMode, gcForceMode, gcForceBlockMode. gcBackgroundMode is triggered by sysmon and memory increasing. gcForceBlockMode is triggered by runtime.GC. I don't find any function using gcForceMode or any API exposed the ability for user to.use this mode. So why should we keep this mode to increase the complex of codes?

@josharian

This comment has been minimized.

Copy link
Contributor

commented Mar 19, 2017

@bradfitz bradfitz added this to the Go1.9Maybe milestone Mar 21, 2017

@aclements

This comment has been minimized.

Copy link
Member

commented Mar 30, 2017

You're right that this mode is not currently used for anything (it used to be used for sysmon GC). It could be deleted, though it's not really complicating the code in any way.

It's likely that I'll delete all of the modes as well as the code paths for gcForceMode and gcForceBlockMode once golang.org/cl/37520 is in, but feel free to send a CL deleting gcForceMode before then.

@aclements aclements modified the milestones: Go1.10, Go1.9Maybe Jul 7, 2017

@aclements

This comment has been minimized.

Copy link
Member

commented Jul 7, 2017

Actually, I'm wrong. gcForceMode is used. We set the mode to gcForceMode if GODEBUG=gcstoptheworld=1. And while nothing explicitly checks if mode == gcForceMode, it's important that it be different from gcBackgroundMode and gcForceBlockMode because there are checks against both of those.

At any rate, whenever I actually get around to consolidating the STW and concurrent GC paths, I might replace these mode checks with checks against debug.gcstoptheworld, at which point, all of the modes will go away. But until then, this mode is still used.

@aclements aclements closed this Jul 7, 2017

@golang golang locked and limited conversation to collaborators Jul 7, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.