Revert "Allow workitems to startup faster and reduce polling thread interval in the...
authorRodrigo Kumpera <kumpera@gmail.com>
Fri, 27 Sep 2013 23:51:54 +0000 (19:51 -0400)
committerRodrigo Kumpera <kumpera@gmail.com>
Fri, 27 Sep 2013 23:51:54 +0000 (19:51 -0400)
This commit is causing unbound growth in the number of threads for a series of workloads.

It's leading a sgen test to crash with 800 tp threads around, which doesn't make sense on a
4 cores system with default TP configuration.

This reverts commit 3c347d5d3a9c58666ef33c96e28a16c751e59619.

mono/metadata/threadpool.c

index 438713c2bffdf5187e6b298756861df00efc623c..8710dafd661e8d26ac41f99ec451bd617400a474 100644 (file)
@@ -771,7 +771,7 @@ monitor_thread (gpointer unused)
        thread = mono_thread_internal_current ();
        ves_icall_System_Threading_Thread_SetName_internal (thread, mono_string_new (mono_domain_get (), "Threadpool monitor"));
        while (1) {
-               ms = 2000;
+               ms = 500;
                i = 10; //number of spurious awakes we tolerate before doing a round of rebalancing.
                do {
                        guint32 ts;
@@ -1041,7 +1041,6 @@ pulse_on_new_job (ThreadPool *tp)
 {
        if (tp->waiting)
                MONO_SEM_POST (&tp->new_job);
-       threadpool_start_thread (tp);
 }
 
 void
@@ -1097,7 +1096,7 @@ threadpool_append_jobs (ThreadPool *tp, MonoObject **jobs, gint njobs)
                mono_cq_enqueue (tp->queue, ar);
        }
 
-       for (i = 0; i < MIN(njobs, tp->max_threads); i++)
+       for (i = 0; tp->waiting > 0 && i < MIN(njobs, tp->max_threads); i++)
                pulse_on_new_job (tp);
 }