Description
When the world was still young, the Sweeper used to rely on safepoints to both mark on-stack nmethods, as well use it for heuristics (safepoint counters used to figure out when to sweep, and hotness counters used to sample on-stack nmethods).
Now, spurious safepoints are getting removed left and right every day, and we are finding ourselves in a situation where safepoints are going to be very sparse. The remaining trace of this safepoint reliance, is the on-stack nmethod hotness counter sampling that is performed in safepoints.
This per-thread sampling in a safepoint is not sparking joy for my JEP 376: ZGC: Concurrent Thread-Stack Processing, where the goal is to remove per-thread processing from GC safepoints. This sampling needs to be removed from the safepoint cleanup.
Notably, the hotness counters are already poked during the sweeper nmethod marking operation. And since the nmethod marking operation is likely more when sweeping is of importance, and then probably more often than safepoints run, it would make sense to let the nmethod marking operation, also take full responsibility for the nmethod hotness counter sampling, without any reliance on safepoints and their cleanup.
Now, spurious safepoints are getting removed left and right every day, and we are finding ourselves in a situation where safepoints are going to be very sparse. The remaining trace of this safepoint reliance, is the on-stack nmethod hotness counter sampling that is performed in safepoints.
This per-thread sampling in a safepoint is not sparking joy for my JEP 376: ZGC: Concurrent Thread-Stack Processing, where the goal is to remove per-thread processing from GC safepoints. This sampling needs to be removed from the safepoint cleanup.
Notably, the hotness counters are already poked during the sweeper nmethod marking operation. And since the nmethod marking operation is likely more when sweeping is of importance, and then probably more often than safepoints run, it would make sense to let the nmethod marking operation, also take full responsibility for the nmethod hotness counter sampling, without any reliance on safepoints and their cleanup.