summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2015-04-16 17:23:31 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-04-16 17:23:36 +0000
commit73a3fb3d884f14e5de488bc679da4ce5ac7700be (patch)
tree23cefb49a93447538480fb567a18f1965794c50b
parent50a4d671268cff5041fb09dcb9f64515dd809e4a (diff)
parent10d6886c9ce3ed87431cf10d376a69c23950fa61 (diff)
downloadart-73a3fb3d884f14e5de488bc679da4ce5ac7700be.zip
art-73a3fb3d884f14e5de488bc679da4ce5ac7700be.tar.gz
art-73a3fb3d884f14e5de488bc679da4ce5ac7700be.tar.bz2
Merge "Disable parallel GC by default"
-rw-r--r--runtime/gc/collector/mark_sweep.cc6
-rw-r--r--runtime/gc/heap.h2
-rw-r--r--runtime/parsed_options.cc4
-rw-r--r--runtime/runtime_options.def2
4 files changed, 6 insertions, 8 deletions
diff --git a/runtime/gc/collector/mark_sweep.cc b/runtime/gc/collector/mark_sweep.cc
index bb8d876..e65d1f1 100644
--- a/runtime/gc/collector/mark_sweep.cc
+++ b/runtime/gc/collector/mark_sweep.cc
@@ -740,11 +740,7 @@ size_t MarkSweep::GetThreadCount(bool paused) const {
if (heap_->GetThreadPool() == nullptr || !heap_->CareAboutPauseTimes()) {
return 1;
}
- if (paused) {
- return heap_->GetParallelGCThreadCount() + 1;
- } else {
- return heap_->GetConcGCThreadCount() + 1;
- }
+ return (paused ? heap_->GetParallelGCThreadCount() : heap_->GetConcGCThreadCount()) + 1;
}
void MarkSweep::ScanGrayObjects(bool paused, uint8_t minimum_age) {
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index 2f62798..066b4c5 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -145,6 +145,8 @@ class Heap {
static constexpr double kDefaultHeapGrowthMultiplier = 2.0;
// Primitive arrays larger than this size are put in the large object space.
static constexpr size_t kDefaultLargeObjectThreshold = 3 * kPageSize;
+ // Whether or not parallel GC is enabled. If not, then we never create the thread pool.
+ static constexpr bool kDefaultEnableParallelGC = false;
// Whether or not we use the free list large object space. Only use it if USE_ART_LOW_4G_ALLOCATOR
// since this means that we have to use the slow msync loop in MemMap::MapAnonymous.
diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc
index 0758b27..620a4bd 100644
--- a/runtime/parsed_options.cc
+++ b/runtime/parsed_options.cc
@@ -442,8 +442,8 @@ bool ParsedOptions::Parse(const RuntimeOptions& options, bool ignore_unrecognize
}
// Default to number of processors minus one since the main GC thread also does work.
- args.SetIfMissing(M::ParallelGCThreads,
- static_cast<unsigned int>(sysconf(_SC_NPROCESSORS_CONF) - 1u));
+ args.SetIfMissing(M::ParallelGCThreads, gc::Heap::kDefaultEnableParallelGC ?
+ static_cast<unsigned int>(sysconf(_SC_NPROCESSORS_CONF) - 1u) : 0u);
// -Xverbose:
{
diff --git a/runtime/runtime_options.def b/runtime/runtime_options.def
index eff787a..8b504c1 100644
--- a/runtime/runtime_options.def
+++ b/runtime/runtime_options.def
@@ -50,7 +50,7 @@ RUNTIME_OPTIONS_KEY (MemoryKiB, HeapMaxFree, gc::He
RUNTIME_OPTIONS_KEY (MemoryKiB, NonMovingSpaceCapacity, gc::Heap::kDefaultNonMovingSpaceCapacity)
RUNTIME_OPTIONS_KEY (double, HeapTargetUtilization, gc::Heap::kDefaultTargetUtilization)
RUNTIME_OPTIONS_KEY (double, ForegroundHeapGrowthMultiplier, gc::Heap::kDefaultHeapGrowthMultiplier)
-RUNTIME_OPTIONS_KEY (unsigned int, ParallelGCThreads, 1u)
+RUNTIME_OPTIONS_KEY (unsigned int, ParallelGCThreads, 0u)
RUNTIME_OPTIONS_KEY (unsigned int, ConcGCThreads)
RUNTIME_OPTIONS_KEY (Memory<1>, StackSize) // -Xss
RUNTIME_OPTIONS_KEY (unsigned int, MaxSpinsBeforeThinLockInflation,Monitor::kDefaultMaxSpinsBeforeThinLockInflation)