From c34895470fad6b1aa29fce53d54c76cf413225f5 Mon Sep 17 00:00:00 2001
From: Matthew Pickering <matthewtpickering@gmail.com>
Date: Thu, 11 Apr 2024 15:02:25 +0100
Subject: [PATCH] rts: Improve tracing message when nursery is resized

It is sometimes more useful to know how much bigger or smaller the
nursery got when it is resized.

In particular I am trying to investigate situations where we end up with
fragmentation due to the nursery (#24577)
---
 rts/sm/Storage.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c
index 722d9dc19b29..bf9e08de51ed 100644
--- a/rts/sm/Storage.c
+++ b/rts/sm/Storage.c
@@ -881,8 +881,8 @@ resizeNurseriesEach (W_ blocks)
 
         node = capNoToNumaNode(i);
         if (nursery_blocks < blocks) {
-            debugTrace(DEBUG_gc, "increasing size of nursery to %d blocks",
-                       blocks);
+            debugTrace(DEBUG_gc, "increasing size of nursery from %d to %d blocks",
+                       nursery_blocks, blocks);
             nursery->blocks = allocNursery(node, nursery->blocks,
                                            blocks-nursery_blocks);
         }
@@ -890,8 +890,8 @@ resizeNurseriesEach (W_ blocks)
         {
             bdescr *next_bd;
 
-            debugTrace(DEBUG_gc, "decreasing size of nursery to %d blocks",
-                       blocks);
+            debugTrace(DEBUG_gc, "decreasing size of nursery from %d to %d blocks",
+                       nursery_blocks, blocks);
 
             bd = nursery->blocks;
             while (nursery_blocks > blocks) {
@@ -905,6 +905,8 @@ resizeNurseriesEach (W_ blocks)
             // might have gone just under, by freeing a large block, so make
             // up the difference.
             if (nursery_blocks < blocks) {
+                debugTrace(DEBUG_gc, "reincreasing size of nursery from %d to %d blocks",
+                             nursery_blocks, blocks);
                 nursery->blocks = allocNursery(node, nursery->blocks,
                                                blocks-nursery_blocks);
             }
-- 
GitLab