JDK-8327089 : Release Note: Change LockingMode Default from `LM_LEGACY` to `LM_LIGHTWEIGHT`
  • Type: Sub-task
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 23
  • Priority: P4
  • Status: Resolved
  • Resolution: Delivered
  • Submitted: 2024-02-29
  • Updated: 2024-08-01
  • Resolved: 2024-03-28
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 23
23Resolved
Description
A new lightweight locking mechanism for uncontended object monitor locking was introduced in JDK 21 under JDK-8291555. The `LockingMode` flag was introduced to allow selection of this new mechanism (`LM_LIGHTWEIGHT`, value 2) in place of the default mechanism (`LM_LEGACY`, value 1). In this release, the `LockingMode` default has been changed to `LM_LIGHTWEIGHT`.

This is not expected to change any semantic behavior of Java monitor locking. It is expected to be performance neutral for almost all applications.

If you need to revert to the legacy mechanism, you can set the command-line flag `-XX:LockingMode=1`, but note that legacy mode is expected to be removed in a future release.
Comments
Made one more word tweak in the last sentence.
28-03-2024

The release note looks good to me.
28-03-2024

I like it! Thanks!
28-03-2024

The updated release note looks really good.
27-03-2024

[~dholmes] - I like the rewrite! Thanks for doing it and thanks for fleshing out some of the details of the LockingMode flag. [~coleenp] and [~rkennke] - please re-review the updated Release Note. Thanks!
27-03-2024

After discussion with Dan I have rewritten the RN to explain things more completely, as we don't seem to have documented any of this in the past. Note that I intentionally am not documenting the LockingMode flag itself, as I don't want to draw attention to LM_MONITOR.
27-03-2024

Would it be useful to add a comment about what to do in case of any (unexpected) problems?
27-03-2024

[~rkennke] and [~dholmes] - you were reviewers on my PR for: JDK-8319251 [REDO] Change LockingMode default from LM_LEGACY to LM_LIGHTWEIGHT and the Developer's guide recommends the same people who reviewed the main issue should also review the release note: https://openjdk.org/guide/#release-notes Thanks!
27-03-2024

This release note looks good to me.
27-03-2024

I've done a little bit of research into the background on LockingMode. Here's the CSR: JDK-8315275 Make LockingMode a product flag and the RFE: JDK-8315061 Make LockingMode a product flag It looks like we did not add a Release Note when we added made the option a product flag which was done in JDK22. That's probably because by the end of JDK22, the default value for LockingMode was LM_LEGACY so there was no change in default system behavior.
27-03-2024