RFR: 8300926: Several startup regressions ~6-70% in 21-b6 all platforms

Robbin Ehn rehn at openjdk.org
Fri Feb 17 07:25:23 UTC 2023


On Thu, 16 Feb 2023 19:58:43 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> Hi all, please consider.
>> 
>> The original issue was when thread 1 asked to deopt nmethod set X and thread 2 asked for the same or a subset of X.
>> All method will already be marked, but the actual deoptimizing, not entrant, patching PC on stacks and patching post call nops, was not done yet. Which meant thread 2 could 'pass' thread 1.
>> Most places did deopt under Compile_lock, thus this is not an issue, but WB and clearCallSiteContext do not.
>> 
>> Since a handshakes may take long before completion and Compile_lock is used for so much more than deopts.
>> The fix in https://bugs.openjdk.org/browse/JDK-8299074 instead always emitted a handshake even when everything was already marked. (instead of adding Compile_lock to all places)
>> 
>> This turnout to be problematic in the startup, for example the number of deopt handshakes in jetty dry run startup went from 5 to 39 handshakes.
>> 
>> This fix first adds a barrier for which you do not pass until the requested deopts have happened and it coalesces the handshakes.
>> Secondly it moves handshakes part out of the Compile_lock where it is possible.
>> 
>> Which means we fix the performance bug and we reduce the contention on Compile_lock, meaning higher throughput in compiler and things such as class-loading.
>> 
>> It passes t1-t7 with flying colours! t8 still not completed and I'm redoing some testing due to last minute simplifications.
>> 
>> Thanks, Robbin
>
> src/hotspot/share/runtime/deoptimization.cpp line 123:
> 
>> 121:   // If it's already marked but we still need it to be deopted.
>> 122:   if (cm->is_marked_for_deoptimization()) {
>> 123:     dependant(cm);
> 
> nit typo: s/dependant/dependent/

Fixed, thanks!

> src/hotspot/share/runtime/deoptimization.cpp line 139:
> 
>> 137: }
>> 138: 
>> 139: void DeoptimizationScope::dependant(CompiledMethod* cm) {
> 
> nit typo: s/dependant/dependent/

Fixed, thanks!

> src/hotspot/share/runtime/deoptimization.hpp line 59:
> 
>> 57:   DeoptimizationScope();
>> 58:   ~DeoptimizationScope();
>> 59:   // Mark a method, if already marked as dependant.
> 
> nit typo: s/dependant/dependent/

Fixed, thanks!

> src/hotspot/share/runtime/deoptimization.hpp line 61:
> 
>> 59:   // Mark a method, if already marked as dependant.
>> 60:   void mark(CompiledMethod* cm, bool inc_recompile_counts = true);
>> 61:   // Record this as a dependant method.
> 
> nit typo: s/dependant/dependent/

Fixed, thanks!

> src/hotspot/share/runtime/deoptimization.hpp line 65:
> 
>> 63: 
>> 64:   // Execute the deoptimization.
>> 65:   // Mmake the nmethods not entrant, stackwalks and patch return pcs and sets post call nops.
> 
> nit typo: s/Mmake/Make/

Fixed, thanks!

-------------

PR: https://git.openjdk.org/jdk/pull/12585


More information about the hotspot-dev mailing list