8217343: Shenandoah control thread should be able to run at critical priority
authorshade
Sat, 19 Jan 2019 11:20:01 +0100
changeset 53403 683a112e0e1e
parent 53402 456e3870579e
child 53404 9ff1e6cacac3
8217343: Shenandoah control thread should be able to run at critical priority Reviewed-by: rkennke
src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp
src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp
test/hotspot/jtreg/gc/shenandoah/options/TestCriticalControlThreadPriority.java
--- a/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp	Sat Jan 19 11:19:55 2019 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp	Sat Jan 19 11:20:01 2019 +0100
@@ -47,7 +47,7 @@
   _degen_point(ShenandoahHeap::_degenerated_outside_cycle),
   _allocs_seen(0) {
 
-  create_and_start();
+  create_and_start(ShenandoahCriticalControlThreadPriority ? CriticalPriority : NearMaxPriority);
   _periodic_task.enroll();
   _periodic_satb_flush_task.enroll();
 }
--- a/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp	Sat Jan 19 11:19:55 2019 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp	Sat Jan 19 11:20:01 2019 +0100
@@ -185,6 +185,9 @@
           "adjustment. Lower values make adjustments faster, at the "       \
           "expense of higher perf overhead. Time is in milliseconds.")      \
                                                                             \
+  experimental(bool, ShenandoahCriticalControlThreadPriority, false,        \
+          "Shenandoah control thread runs at critical scheduling priority.")\
+                                                                            \
   diagnostic(bool, ShenandoahVerify, false,                                 \
           "Verify the Shenandoah garbage collector")                        \
                                                                             \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/gc/shenandoah/options/TestCriticalControlThreadPriority.java	Sat Jan 19 11:20:01 2019 +0100
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2019, Red Hat, Inc. All rights reserved.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test TestCriticalControlThreadPriority
+ * @summary Check that ShenandoahCriticalControlThreadPriority works
+ * @bug 8217343
+ * @key gc
+ * @requires vm.gc.Shenandoah
+ *
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:-ShenandoahCriticalControlThreadPriority -Xmx1g TestCriticalControlThreadPriority
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:+ShenandoahCriticalControlThreadPriority -Xmx1g TestCriticalControlThreadPriority
+ */
+
+public class TestCriticalControlThreadPriority {
+
+    public static void main(String[] args) throws Exception {
+        // checking the initialization before entering main()
+    }
+
+}