JDK-8259349 : -XX:AvgMonitorsPerThreadEstimate=1 does not work right
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 16
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2021-01-06
  • Updated: 2021-03-11
  • Resolved: 2021-01-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17
17 b05Fixed
Related Reports
Blocks :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
The AvgMonitorsPerThreadEstimate option does not work quite
right when trying to use a value lower than the default of 1024.

The _in_use_list_ceiling variable is statically initialized to
AvgMonitorsPerThreadEstimate and that happens before
cmd line options are processed. So when you try to use
-XX:AvgMonitorsPerThreadEstimate=1 you end up with an
_in_use_list_ceiling of 1024 + <#-of-JavaThreads>. I see
an _in_use_list_ceiling of 1034 in some of the testing that
I'm doing for JDK-8226416.
Comments
Changeset: c338f116 Author: Daniel D. Daugherty <dcubed@openjdk.org> Date: 2021-01-12 14:39:58 +0000 URL: https://git.openjdk.java.net/jdk/commit/c338f116
12-01-2021

Move the initialization of _in_use_list_ceiling to the ObjectSynchronizer()::initialize() function so that it happens after cmd line options are parsed.
06-01-2021