-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Description
I'm doing some performance analysis of go1.20 on arm64 platform, and I found that the DMB instruction in mallocgc consumes a lot of time.
I found some CLs:
- CL11083: In
go1.5,publicationBarrierwas added when allocating scan objects. - CL23043: In
go1.7,publicationBarrieris was added when allocating noscan objects because of theheapBitsSetTypeNoScan. - CL41253: However,
publicationBarrieris still called when allocating noscan objects afterheapBitsSetTypeNoScanis deleted.
I tried to find the reason why publicationBarrier was called when allocating noscan objects, but I couldn't find it.
Knowing from the comments of source code, publicationBarrier in mallocgc ensure that the stores above that initialize x to type-safe memory and set the heap bits occur before the caller can make x observable to the GC. publicationBarrier in allocSpan make sure the newly allocated span will be observed by the GC before pointers into the span are published.
My question is, GC don't scan noscan object, why is publicationBarrier required when allocating noscan objects in mallocgc?
Thank you in advance for your help.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status