os::serialize_thread_states implements a pseudo memory barrier as part of the ADS synchronization mechanism for the thread safepoint states.
The implementation relies on side-effects of modifying the page protection bits in order to generate some sort of IPI in the OS kernel.
Both Windows and Linux now provide an explicit userspace API for triggering such an IPI.
On Windows the entry point is FlushProcessWriteBuffers()
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683148%28v=vs.85%29.aspx (Vista and up)
On Linux the syscall entry point is sys_membarrier is available from kernel version 4.3 but since the syscall may not be exposed by glibc it may be necessary to invoke the syscall directly, on x64 it's #324, more information at:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=5b25b13ab08f616efd566347d809b4ece54570d1
and at
http://man7.org/linux/man-pages/man2/membarrier.2.html
The implementation relies on side-effects of modifying the page protection bits in order to generate some sort of IPI in the OS kernel.
Both Windows and Linux now provide an explicit userspace API for triggering such an IPI.
On Windows the entry point is FlushProcessWriteBuffers()
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683148%28v=vs.85%29.aspx (Vista and up)
On Linux the syscall entry point is sys_membarrier is available from kernel version 4.3 but since the syscall may not be exposed by glibc it may be necessary to invoke the syscall directly, on x64 it's #324, more information at:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=5b25b13ab08f616efd566347d809b4ece54570d1
and at
http://man7.org/linux/man-pages/man2/membarrier.2.html
- relates to
-
JDK-8187809 UseMembar should be set true and deprecate the flag
- Resolved
-
JDK-8213436 Obsolete UseMembar
- Resolved
-
JDK-8143878 Memory serialization page can become a bottleneck
- Closed