RFR: JDK-8283674: Pad ObjectMonitor allocation size to cache line size

Thomas Stuefe stuefe at openjdk.java.net
Mon Mar 28 13:25:48 UTC 2022


On Mon, 28 Mar 2022 13:09:32 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

> Note that the padding only avoids that the same fields of different ObjectMonitors can end up on the same cache line. The beginning of the next one can still fall into the same cache line as the end of the previous one. We'd need alignment to fix that. 

Oh, you are right, good catch. We'd need posix_memalign. We don't have an abstraction for that in os. The alternative would be the typical solution of malloc'ing size * 2 and then aligning up. Sigh, what a nuisance.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7955


More information about the hotspot-runtime-dev mailing list