RFR (S): JEP-142: Reduce Cache Contention on Specified Fields

Aleksey Shipilev aleksey.shipilev at oracle.com
Thu Nov 22 14:00:46 PST 2012


Hi Martijn,

On 11/23/2012 01:55 AM, Martijn Verburg wrote:
> Is this based on detecting the size of the cache line of the CPU the
> JVM is running on and multiplying by two?

Not yet. We use the constant 128 bytes, overridable with
-XX:FieldPaddingWidth. The cache line detection is there in Hotspot, and
I still need to wire this up into the patch. The really sad part is that
we can not detect the presence of hardware prefetcher running without
reading the MSRs, which might in the end require superuser privileges.

> As an extra aside - I'm wondering if the IDE vendors could pick up
> on this and actually visualise for you how your class will be laid
> out. Would be useful when applying @Contented and making sure it's
> padding as you'd want it to.

Yup, as soon as class is loaded by the VM, it is actually pretty easy to
do, see:
  https://github.com/shipilev/java-field-layout

-Aleksey.



More information about the hotspot-dev mailing list