summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2015-12-03 22:02:34 -0800
committerJan Kotas <jkotas@microsoft.com>2015-12-03 22:02:34 -0800
commitcb985b29e27fcde2f421c683297901b27a2f1448 (patch)
treee1a83b6396abec0edbd87ecb32bf47241d267863
parent4c4b5a92d2d8e7dc56e76c0c5979263effbff2c7 (diff)
parent9b2d53bd5e95cad88e32a0e2b3b2fee5f4ebd21a (diff)
downloadcoreclr-cb985b29e27fcde2f421c683297901b27a2f1448.tar.gz
coreclr-cb985b29e27fcde2f421c683297901b27a2f1448.tar.bz2
coreclr-cb985b29e27fcde2f421c683297901b27a2f1448.zip
Merge pull request #2219 from kouvel/ConcurrentGc
Fix perf issue when concurrent GC is enabled by default
-rw-r--r--src/dlls/mscoree/unixinterface.cpp3
-rw-r--r--src/gc/gc.cpp29
2 files changed, 22 insertions, 10 deletions
diff --git a/src/dlls/mscoree/unixinterface.cpp b/src/dlls/mscoree/unixinterface.cpp
index 66e35248dd..6a2dbd6c74 100644
--- a/src/dlls/mscoree/unixinterface.cpp
+++ b/src/dlls/mscoree/unixinterface.cpp
@@ -107,7 +107,8 @@ static void ExtractStartupFlagsAndConvertToUnicode(
STARTUP_FLAGS startupFlags =
static_cast<STARTUP_FLAGS>(
STARTUP_FLAGS::STARTUP_LOADER_OPTIMIZATION_SINGLE_DOMAIN |
- STARTUP_FLAGS::STARTUP_SINGLE_APPDOMAIN);
+ STARTUP_FLAGS::STARTUP_SINGLE_APPDOMAIN |
+ STARTUP_FLAGS::STARTUP_CONCURRENT_GC);
int propertyCountW = 0;
for (int propertyIndex = 0; propertyIndex < propertyCount; ++propertyIndex)
{
diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp
index 8a1f988422..6ec0f6e25e 100644
--- a/src/gc/gc.cpp
+++ b/src/gc/gc.cpp
@@ -14216,11 +14216,12 @@ int gc_heap::joined_generation_to_condemn (BOOL should_evaluate_elevation,
}
#ifdef STRESS_HEAP
+#ifdef BACKGROUND_GC
// We can only do Concurrent GC Stress if the caller did not explicitly ask for all
// generations to be collected,
if (n_original != max_generation &&
- g_pConfig->GetGCStressLevel() && g_pConfig->GetGCconcurrent())
+ g_pConfig->GetGCStressLevel() && gc_can_use_concurrent)
{
#ifndef FEATURE_REDHAWK
// for the GC stress mix mode throttle down gen2 collections
@@ -14254,6 +14255,7 @@ int gc_heap::joined_generation_to_condemn (BOOL should_evaluate_elevation,
n = max_generation;
}
}
+#endif //BACKGROUND_GC
#endif //STRESS_HEAP
return n;
@@ -14833,14 +14835,16 @@ exit:
if (!check_only_p)
{
#ifdef STRESS_HEAP
+#ifdef BACKGROUND_GC
// We can only do Concurrent GC Stress if the caller did not explicitly ask for all
// generations to be collected,
if (orig_gen != max_generation &&
- g_pConfig->GetGCStressLevel() && g_pConfig->GetGCconcurrent())
+ g_pConfig->GetGCStressLevel() && gc_can_use_concurrent)
{
*elevation_requested_p = FALSE;
}
+#endif //BACKGROUND_GC
#endif //STRESS_HEAP
if (check_memory)
@@ -29345,13 +29349,20 @@ bool gc_heap::init_dynamic_data()
dd->min_gc_size = Align(gen0size / 8 * 5);
dd->min_size = dd->min_gc_size;
//dd->max_size = Align (gen0size);
-//g_pConfig->GetGCconcurrent() is not necessarily 0 for server builds
+
+#ifdef BACKGROUND_GC
+ //gc_can_use_concurrent is not necessarily 0 for server builds
+ bool can_use_concurrent = gc_can_use_concurrent;
+#else // !BACKGROUND_GC
+ bool can_use_concurrent = false;
+#endif // BACKGROUND_GC
+
#ifdef MULTIPLE_HEAPS
dd->max_size = max (6*1024*1024, min ( Align(get_valid_segment_size()/2), 200*1024*1024));
#else //MULTIPLE_HEAPS
- dd->max_size = ((g_pConfig->GetGCconcurrent()!=0) ?
- 6*1024*1024 :
- max (6*1024*1024, min ( Align(get_valid_segment_size()/2), 200*1024*1024)));
+ dd->max_size = (can_use_concurrent ?
+ 6*1024*1024 :
+ max (6*1024*1024, min ( Align(get_valid_segment_size()/2), 200*1024*1024)));
#endif //MULTIPLE_HEAPS
dd->new_allocation = dd->min_gc_size;
dd->gc_new_allocation = dd->new_allocation;
@@ -29374,9 +29385,9 @@ bool gc_heap::init_dynamic_data()
#ifdef MULTIPLE_HEAPS
dd->max_size = max (6*1024*1024, Align(get_valid_segment_size()/2));
#else //MULTIPLE_HEAPS
- dd->max_size = ((g_pConfig->GetGCconcurrent()!=0) ?
- 6*1024*1024 :
- max (6*1024*1024, Align(get_valid_segment_size()/2)));
+ dd->max_size = (can_use_concurrent ?
+ 6*1024*1024 :
+ max (6*1024*1024, Align(get_valid_segment_size()/2)));
#endif //MULTIPLE_HEAPS
dd->new_allocation = dd->min_gc_size;
dd->gc_new_allocation = dd->new_allocation;