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

Robbin Ehn rehn at openjdk.org
Tue Mar 7 09:26:36 UTC 2023


On Tue, 7 Mar 2023 08:25:06 GMT, Robbin Ehn <rehn 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
>
> Robbin Ehn has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains ten additional commits since the last revision:
> 
>  - Merge branch 'master' into 8300926
>  - Comment fixes
>  - Include/fwd fixes
>  - More review fixes
>  - Coleen fix
>  - Review fixes 2
>  - Review fixes
>  - Fixed WS
>  - Deopt scopes

`vmClasses::resolve_shared_class`
It's only an micro-optimization to remove lock, since we are single-threaded when this code runs.

The calls above:
`dictionary->add_klass`
`InstanceKlass::restore_unshareable_info`
can also grab locks.

Since we pass all tests and other paths may take locks I'm not concerned.

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

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


More information about the hotspot-dev mailing list