Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8152292

Consider using proper OS APIs for os::serialize_thread_states

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P3 P3
    • tbd
    • 9
    • hotspot

      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

            Unassigned Unassigned
            mgerdin Mikael Gerdin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: