< prev index next >

test/hotspot/jtreg/gc/shenandoah/TestEvilSyncBug.java

Print this page
rev 57639 : 8237038: Shenandoah: Reduce thread pool size in TestEvilSyncBug.java test

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2016, 2018, Red Hat, Inc. All rights reserved.
+ * Copyright (c) 2016, 2020, 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.
  *

@@ -47,12 +47,14 @@
 
     public static void main(String[] args) throws Exception {
         if (args.length > 0) {
             test();
         } else {
-            ExecutorService pool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
-
+            // Use 1/4 of available processors to avoid over provisioning thread pool on many core
+            // systems.
+            int numProcessors = Runtime.getRuntime().availableProcessors();
+            ExecutorService pool = Executors.newFixedThreadPool(Math.max(1, numProcessors / 4));
             Future<?>[] fs = new Future<?>[NUM_RUNS];
 
             for (int c = 0; c < NUM_RUNS; c++) {
                 Callable<Void> task = () -> {
                     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xms128m",
< prev index next >