-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: replace free list with direct bitmap allocation #12800
Comments
I've uploaded the design doc CL at https://golang.org/cl/15210 |
CL https://golang.org/cl/15210 mentions this issue. |
Updates golang/go#12800. Change-Id: I7d040d8b96d401e2420d59c7d66bfe88a42bec08 Reviewed-on: https://go-review.googlesource.com/15210 Reviewed-by: Andrew Gerrand <adg@golang.org>
The design doc can now be viewed in its native habitat at https://github.com/golang/proposal/blob/master/design/12800-sweep-free-alloc.md |
@aclements Hi Austin, what is the plan for this? Is there will be proof of concept implementation. E.g. modify the GC, pass all the tests, etc. Thanks for all the work. |
We have a partial prototype that still has bugs and is laden with On Fri, Oct 2, 2015 at 5:54 PM, Dragomir Ivanov notifications@github.com
|
CL https://golang.org/cl/15560 mentions this issue. |
Accepting proposal. Certainly this is fine to implement and see how it works. |
Bitmap allocation was merged in April with commit 56b5491 (plus a few follow-ups after the merge). |
All current releases of Go up to and including Go 1.5 use a mark-sweep garbage collector. As of Go 1.5, this works by alternating between a mostly-concurrent mark phase and a concurrent sweep phase. The mark phase finds all reachable objects and marks them, leaving all unreachable objects unmarked. The sweep phase walks through the entire heap, finds all unmarked objects, and adds them to free lists, which the allocator in turn uses to allocate new objects.
However, this sweep phase is, in a sense, redundant. It primarily transforms one representation of the free heap—the mark bits—into another representation of the free heap—the free lists. Not only does this take time, but the free list representation is unfriendly to modern CPUs since it is not very cacheable and accesses to it are hard to predict. Furthermore, the current mark representation is also cache-unfriendly, which adds even more to the cost of sweeping. All told, typical Go programs spend about 5% of their CPU time in the sweeper or in cache misses induced by the free list representation.
I propose eliminating the sweeper by foregoing the free list representation entirely and finding free objects directly using the mark bitmap. This can be done efficiently using a dense representation for mark bits separate from the current heap bitmap that enables fast scanning and clearing. This separate mark bitmap will also make it easy to maintain multiple mark bitmaps simultaneously, which is important for future GC improvements.
The text was updated successfully, but these errors were encountered: