< prev index next >

src/hotspot/share/runtime/serviceThread.cpp

Print this page
rev 56044 : imported patch 8230184.patch
rev 56046 : v2.00 -> v2.05 (CR5/v2.05/8-for-jdk13) patches combined into one; merge with 8229212.patch; merge with jdk-14+11; merge with 8230184.patch.
rev 56049 : Merge the remainder of the lock-free monitor list changes from v2.06 with v2.06a and v2.06b after running the changes through the edit scripts; merge pieces from dcubed.monitor_deflate_conc.v2.06d in dcubed.monitor_deflate_conc.v2.06[ac]; merge pieces from dcubed.monitor_deflate_conc.v2.06e into dcubed.monitor_deflate_conc.v2.06c; merge with jdk-14+11; test work around for test/jdk/tools/jlink/multireleasejar/JLinkMultiReleaseJarTest.java should not been needed anymore.

@@ -188,29 +188,25 @@
 
     if (deflate_idle_monitors) {
       // Deflate any global idle monitors.
       ObjectSynchronizer::deflate_global_idle_monitors_using_JT();
 
-      // deflate_per_thread_idle_monitors_using_JT() is called by
-      // each JavaThread from ObjectSynchronizer::omAlloc() as needed.
       int count = 0;
       for (JavaThreadIteratorWithHandle jtiwh; JavaThread *jt = jtiwh.next(); ) {
-        if (jt->om_in_use_count > 0) {
-          // This JavaThread is using monitors so request deflation.
-          jt->om_request_deflation = true;
+        if (jt->om_in_use_count > 0 && !jt->is_exiting()) {
+          // This JavaThread is using ObjectMonitors so deflate any that
+          // are idle unless this JavaThread is exiting; do not race with
+          // ObjectSynchronizer::om_flush().
+          ObjectSynchronizer::deflate_per_thread_idle_monitors_using_JT(jt);
           count++;
         }
       }
       if (count > 0) {
-        log_debug(monitorinflation)("requesting async deflation of idle monitors for %d thread(s).", count);
+        log_debug(monitorinflation)("did async deflation of idle monitors for %d thread(s).", count);
       }
       // The ServiceThread's async deflation request has been processed.
       ObjectSynchronizer::set_is_async_deflation_requested(false);
-
-      // The global in-use list was handled above, but the request won't
-      // be complete until the JavaThreads have handled their in-use
-      // lists. This is the nature of an async deflation request.
     }
   }
 }
 
 bool ServiceThread::is_service_thread(Thread* thread) {
< prev index next >