JDK-8315881 : Change LockingMode default from LM_LEGACY to LM_LIGHTWEIGHT
  • Type: CSR
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 22
  • Submitted: 2023-09-07
  • Updated: 2024-06-14
  • Resolved: 2023-09-19
Related Reports
CSR :  
Relates :  
Description
Summary
-------

Change "LockingMode" default value from LM_LEGACY to LM_LIGHTWEIGHT.

Problem
-------

The enhancement JDK-8291555 has introduced the experimental option "LockingMode" which improves performance in some scenarios.
The enhancement JDK-8315061 changed LockingMode into a product flag.
Now it is time to change the default from LM_LEGACY to LM_LIGHTWEIGHT
in order to make the benefits available by default.

Solution
--------

Change the default flag from LM_LEGACY to LM_LIGHTWEIGHT.

Specification
-------------

    -    product(int, LockingMode, LM_LEGACY,                                       \
    +    product(int, LockingMode, LM_LIGHTWEIGHT,                                  \
                  "Select locking mode: "                                           \
                  "0: monitors only (LM_MONITOR), "                                 \
                  "1: monitors & legacy stack-locking (LM_LEGACY, default), "       \
                  "2: monitors & new lightweight locking (LM_LIGHTWEIGHT)")         \
                  range(0, 2)                                                       \
Comments
Moving to Approved.
19-09-2023

[~dcubed] looks fine. I think you can Finalize this now. Thanks
18-09-2023

[~dholmes] - I've changed the compatibility risk to "low" and I've added a stab at a compatibility risk description. Feel free to edit.
18-09-2023

There needs to be a compatibility risk description added. I would tend to mark it as Low rather than Minimal (subjective of course). The main issue would be performance, especially if applications hit "boundary conditions" for the new locking code. Functionally these should be 100% equivalent.
18-09-2023

The Tech Leads and Managers meeting has requested that we try to get this change into JDK22 so that it can be available earlier for the Lilliput project. We definitely have the soak time available in JDK22.
18-09-2023

Please note that the fix version is currently '23' since that was the original plan. This may change to '22' depending on discussions.
07-09-2023

Copied a comment from [~dholmes] from JDK-8315275: dholmes David Holmes added a comment - 2023-08-29 19:45 - edited I suspect that when LM_LEGACY is eventually removed, that this would revert to a diagnostic flag to allow use of LM_MONITOR. In the meantime we need a product flag to enable initial production testing, and then transition to LM_LIGHTWEIGHT.
07-09-2023

More details from the Enhancement: The LockingMode flag from JDK-8291555 was implemented as an experimental flag. We made it a regular product flag in JDK22 in preparation for project Lilliput (See JDK-8315061). In the next release, we plan to change the default of the LockingMode flag from LM_LEGACY to LM_LIGHTWEIGHT. Project Lilliput needs the LockingMode flag to be LM_LIGHTWEIGHT. In a release sometime after the next release, we place to remove support for LM_LEGACY.
07-09-2023