RFR: 8277981: String Deduplication table is never cleaned up due to bad dead_factor_for_cleanup

Aleksey Shipilev shade at openjdk.java.net
Tue Nov 30 16:52:04 UTC 2021

On Tue, 30 Nov 2021 12:30:11 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> See the reproducer and analysis in the bug. 
> The root cause for this problem is that `percent_of` returns `0..100` (percent) value of `nominator / denominator`. Which means if we feed `percent` and `100` there, this is an identity operation, returning the same value. And we wanted the conversion from percent to factor instead.
> The default value for `StringDeduplicationCleanupDeadPercent` is `5`, which means (assuming `dead_count <= entry_count`) this erroneous conversion makes this condition always `false`:
> bool StringDedup::Config::should_cleanup_table(size_t entry_count, size_t dead_count) {
>   return (dead_count > _minimum_dead_for_cleanup) &&
>          (dead_count > (entry_count * _dead_factor_for_cleanup));
> }
> Additional testing:
>  - [x] Reproducer stress test does not leak anymore
>  - [x] Linux x86_64 fastdebug tier1, `-XX:+UseStringDeduplication`
>  - [x] Linux x86_64 fastdebug tier2, `-XX:+UseStringDeduplication`
>  - [x] Linux x86_64 fastdebug tier3, `-XX:+UseStringDeduplication`

Thanks for reviews. I'll wait out the 24 hours for Hotspot patches, and then push. Then I'll go plead to Rob about picking it up to 17.0.2.


PR: https://git.openjdk.java.net/jdk/pull/6613

More information about the hotspot-gc-dev mailing list