JDK-8316180 : Thread-local backoff for secondary_super_cache updates
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,17,21,22
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2023-09-13
  • Updated: 2024-03-21
  • Resolved: 2024-03-21
Related Reports
Relates :  
Sub Tasks
JDK-8318414 :  
Description
This is an attempt to mitigate JDK-8180450, while the more complex fix that would obviate the need for secondary_super_cache is being worked out. The goal for this fix is to improve performance in pathological cases, while staying simple enough for backports. 

This work implements one of the simpler ideas: Make the thread-local counter that gates the attempts to update the secondary cache. On every attempt to update the cache, we decrement the counter. Once the counter goes to zero, we accept the update to the cache and reset the counter to positive "backoff" value. This allows the single-valued cache to quickly converge to a single cached value. In case of contention that results in pathological behaviors described by JDK-8180450, this would allow dodging the contention over the secondary cache slot. _And_ it provides the longer-term safety when cache converts back to effectively single-value one: some thread would be able to finally update the cache. This also alleviates the false sharing problems for frequent secondary_super_cache updates.

The TL counter that is effectively "shared" by all class instances takes just a little bit of additional space.

It would require a bit of coding for every architecture that wants to support it, and we don't have to implement all architectures at once.
Comments
Now that JDK-8180450 has a viable path forward, I see no point in continuing with this one. It has observable regressions on some workloads that are hard to overcome in a simple manner. Closing as WNF.
20-03-2024

OK, working on it...
27-09-2023

Hey [~drwhite], maybe you want to give it a spin through the benchmarks you have? We need to decide on reasonable defaults.
27-09-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/15718 Date: 2023-09-13 14:02:19 +0000
15-09-2023