summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/users_guide/runtime_control.rst2
-rw-r--r--rts/RtsFlags.c18
-rw-r--r--rts/sm/Storage.c13
3 files changed, 19 insertions, 14 deletions
diff --git a/docs/users_guide/runtime_control.rst b/docs/users_guide/runtime_control.rst
index 0ffb1d8206..54c7508ba8 100644
--- a/docs/users_guide/runtime_control.rst
+++ b/docs/users_guide/runtime_control.rst
@@ -327,7 +327,7 @@ performance.
.. rts-flag:: -n ⟨size⟩
- :default: 0
+ :default: 4m with ``-A16m`` or larger, otherwise 0.
.. index::
single: allocation area, chunk size
diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
index 4bd544ee29..d86b154342 100644
--- a/rts/RtsFlags.c
+++ b/rts/RtsFlags.c
@@ -1454,6 +1454,24 @@ static void normaliseRtsOpts (void)
errorUsage();
}
+ if (RtsFlags.GcFlags.maxHeapSize != 0 &&
+ RtsFlags.GcFlags.heapSizeSuggestion >
+ RtsFlags.GcFlags.maxHeapSize) {
+ RtsFlags.GcFlags.maxHeapSize = RtsFlags.GcFlags.heapSizeSuggestion;
+ }
+
+ if (RtsFlags.GcFlags.maxHeapSize != 0 &&
+ RtsFlags.GcFlags.minAllocAreaSize >
+ RtsFlags.GcFlags.maxHeapSize) {
+ errorBelch("maximum heap size (-M) is smaller than minimum alloc area size (-A)");
+ RtsFlags.GcFlags.minAllocAreaSize = RtsFlags.GcFlags.maxHeapSize;
+ }
+
+ // If we have -A16m or larger, use -n4m.
+ if (RtsFlags.GcFlags.minAllocAreaSize >= (16*1024*1024) / BLOCK_SIZE) {
+ RtsFlags.GcFlags.nurseryChunkSize = (4*1024*1024) / BLOCK_SIZE;
+ }
+
if (RtsFlags.ParFlags.parGcLoadBalancingGen == ~0u) {
StgWord alloc_area_bytes
= RtsFlags.GcFlags.minAllocAreaSize * BLOCK_SIZE;
diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c
index 4d0c8d5260..357e0180d2 100644
--- a/rts/sm/Storage.c
+++ b/rts/sm/Storage.c
@@ -140,19 +140,6 @@ initStorage (void)
ASSERT(LOOKS_LIKE_CLOSURE_PTR(&stg_dummy_ret_closure));
ASSERT(!HEAP_ALLOCED(&stg_dummy_ret_closure));
- if (RtsFlags.GcFlags.maxHeapSize != 0 &&
- RtsFlags.GcFlags.heapSizeSuggestion >
- RtsFlags.GcFlags.maxHeapSize) {
- RtsFlags.GcFlags.maxHeapSize = RtsFlags.GcFlags.heapSizeSuggestion;
- }
-
- if (RtsFlags.GcFlags.maxHeapSize != 0 &&
- RtsFlags.GcFlags.minAllocAreaSize >
- RtsFlags.GcFlags.maxHeapSize) {
- errorBelch("maximum heap size (-M) is smaller than minimum alloc area size (-A)");
- RtsFlags.GcFlags.minAllocAreaSize = RtsFlags.GcFlags.maxHeapSize;
- }
-
initBlockAllocator();
#if defined(THREADED_RTS)