8227226: Segmented array clearing for ZGC
Hohensee, Paul
hohensee at amazon.com
Mon Jul 29 15:07:11 UTC 2019
+1. Pretty much all the time the GC thread doesn't own the lines, so getting them into its cache(s) can produce coherence traffic, though that's usually through the LLC because there aren't many multi-socket systems in use. The main effect we've always seen when we turn on ZeroTLAB is LLC eviction of lines being actively used by other threads. Later when an app thread wants the lines, more coherence traffic might happen. ZeroTLAB hasn't been removed because every once in awhile someone enables it to see if current hardware has done something new to fix the problem.
C2 goes to some trouble to eliminate zeroing by noticing when zero-stores are dead because of initializing stores in a constructor. For scalar and reference fields the zero-store usually goes away, but arrays are more difficult because their content is usually built up during app execution rather than in the constructor.
Parenthetically, on the allocation side we'd love to have an machine instruction that allocates a cache line and zeros it rather than go to memory for it. Such an instruction could replace the current allocation prefetch scheme and significantly reduce off-chip memory bandwidth utilization.
Thanks,
Paul
On 7/26/19, 4:58 PM, "hotspot-gc-dev on behalf of Andrew Haley" <hotspot-gc-dev-bounces at openjdk.java.net on behalf of aph at redhat.com> wrote:
On 7/26/19 6:56 PM, Erik Osterlund wrote:
> I like the direction of [clearing pages when they are reclaimed], as
> I think it will help us down the road.
Are you sure this will help? If the cache lines for a page are already
in exclusive state (i.e. they've been written) when reclaimed this
will be fine, otherwise you're generating extra cache coherence
traffic. You're also evicting the cache of the GC thread by filling it
with zeroed lines.
I guess some careful benchmarking will tell us.
--
Andrew Haley (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
More information about the hotspot-gc-dev
mailing list