RFR(M): 8166970: Adapt mutex padding according to DEFAULT_CACHE_LINE_SIZE
Doerr, Martin
martin.doerr at sap.com
Tue Oct 4 13:15:46 UTC 2016
Hi Coleen,
thank you very much.
Thomas is currently out. The idea to use offsetof wouldn't work because it can only be computed after the layout of the class is computed. (_name[MONITOR_NAME_LEN] is a field of the Monitor class in the original implementation. The MONITOR_NAME_LEN is already needed to compute the class layout.)
Just for information:
The sizes appear to be:
debug build on linux PPC64le:
sizeof(MonitorBase):96, sizeof(Monitor):160, CACHE_LINE_PADDING:32 (no padding used because _name would get less than 64 characters)
product build on linux PPC64le:
sizeof(MonitorBase):56, sizeof(Monitor):128, CACHE_LINE_PADDING:72 (the length of _name gets extended from 64 to 72)
Hence, the change is also relevant for platforms with DEFAULT_CACHE_LINE_SIZE=128 (like PPC64).
A large amount of padding only gets inserted on s390 where we have DEFAULT_CACHE_LINE_SIZE=256.
Maybe someone else wants to review the change. (Thomas is not an official reviewer.)
Thanks and best regards,
Martin
-----Original Message-----
From: Coleen Phillimore [mailto:coleen.phillimore at oracle.com]
Sent: Montag, 3. Oktober 2016 23:33
To: Doerr, Martin <martin.doerr at sap.com>
Subject: Re: RFR(M): 8166970: Adapt mutex padding according to DEFAULT_CACHE_LINE_SIZE
Hi Martin,
This change was approved for JDK9 so I can sponsor it for you anytime.
I don't know if Thomas Steufe was a reviewer or not. I think I prefer
the way you did it to his suggestion, because I like subclasses.
I think you still need another reviewer though, then commit the change
and send me the export file (so it has your comments, etc in it).
thanks,
Coleen
On 9/30/16 11:48 AM, Doerr, Martin wrote:
> Hi,
>
> the current implementation of Monitor padding (mutex.cpp) assumes that cache lines are 64 Bytes. There's a platform dependent define "DEFAULT_CACHE_LINE_SIZE" available which can be used. Purpose of padding is to avoid false sharing.
>
> My proposed change is here:
> http://cr.openjdk.java.net/~mdoerr/8166970_mutex_padding/webrev.00/
>
> Please review. If will also need a sponsor.
>
> Thanks and best regards,
> Martin
>
More information about the hotspot-runtime-dev
mailing list