RFR 8231264: Disable biased-locking and deprecate all flags related to biased-locking

Andrew Haley aph at redhat.com
Mon Nov 18 10:03:27 UTC 2019


On 11/16/19 2:15 AM, Patricio Chilano wrote:
> Biased locking will be disabled by default and all related flags will be 
> deprecated. Performance gains seen when the feature was introduced in 
> the VM are less clear today with modern Java code/processors. Detailed 
> rationale behind the change is included on the description of the bug.

IMO detailed rationale on its own isn't going to do it.  I would
expect to see detailed measurements to justify such an important
change rather than mere assertions. What do your numbers look like?

This paragraph is rather incredible: "The performance gains that were
seen in the past are far less evident today. The cost of executing
atomic instructions has decreased on modern processors since the
introduction of biased locking into the VM"

This test, with no contention:

    @Benchmark
    public void lock(BenchmarkState state) {
        synchronized(state) {
            state.n++;
        }
    }

Benchmark   Mode  Cnt   Score   Error  Units

-XX:+UseBiasedLocking:
Dummy.lock  avgt    3   2.063 ± 0.215  ns/op

-XX:-UseBiasedLocking:
Dummy.lock  avgt    3  14.991 ± 0.365  ns/op

Threadripper 2950X, 3.5Ghz.

I believe that the uncontended case for synchronized blocks is still
important.

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



More information about the hotspot-runtime-dev mailing list