gencgc: scale generation.bytes_consed_between_gc to number of gens
authorNikodemus Siivola <nikodemus@sb-studio.net>
Sun, 29 Apr 2012 17:06:45 +0000 (20:06 +0300)
committerNikodemus Siivola <nikodemus@sb-studio.net>
Sun, 29 Apr 2012 17:32:19 +0000 (20:32 +0300)
  This means we have by default 5% of total heap usable in the nursery
  between GCs, and another 5% of the total heap split between all the
  generations -- and roughly matches the nursery/old generation sizes
  relations from before the dynamic-space-size based scaling.

  Fixes lp#991293, regression since
  6848a92fd4af23d0695eeaaed9efcbdfd9e1d9e5.

NEWS
src/code/gc.lisp
src/runtime/gencgc.c
tests/gc.impure.lisp

diff --git a/NEWS b/NEWS
index b9acb31..897c552 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -35,6 +35,8 @@ changes relative to sbcl-1.0.56:
   * bug fix: miscompilation of LDB on the PowerPC platform.  (thanks to Bruce
     O'Neel)
   * bug fix: better input error reporting for COMPILE-FILE. (lp#493380)
+  * bug fix: default size of non-nursery generations has been shrunk on GENCGC,
+    allowing faster release of memory back to the OS. (lp#991293)
   * documentation:
     ** improved docstrings: REPLACE (lp#965592)
 
index b477d98..a9893b0 100644 (file)
@@ -435,8 +435,8 @@ Note: currently changes to this value are lost when saving core."
       "Number of bytes that can be allocated to GENERATION before that
 generation is considered for garbage collection. This value is meaningless for
 generation 0 (the nursery): see BYTES-CONSED-BETWEEN-GCS instead. Default is
-5% of the dynamic space size. Can be assigned to using SETF. Available on
-GENCGC platforms only.
+5% of the dynamic space size divided by the number of non-nursery generations.
+Can be assigned to using SETF. Available on GENCGC platforms only.
 
 Experimental: interface subject to change."
     t)
index 6decdde..a73bdca 100644 (file)
@@ -4038,7 +4038,8 @@ gc_init(void)
         generations[i].num_gc = 0;
         generations[i].cum_sum_bytes_allocated = 0;
         /* the tune-able parameters */
-        generations[i].bytes_consed_between_gc = bytes_consed_between_gcs;
+        generations[i].bytes_consed_between_gc
+            = bytes_consed_between_gcs/(os_vm_size_t)HIGHEST_NORMAL_GENERATION;
         generations[i].number_of_gcs_before_promotion = 1;
         generations[i].minimum_age_before_gc = 0.75;
     }
index d21d14a..cb9e3e7 100644 (file)
@@ -56,7 +56,8 @@
 (with-test (:name :bug-529014 :skipped-on '(not :gencgc))
   (loop for i from 0 to sb-vm:+pseudo-static-generation+
      do (assert (= (sb-ext:generation-bytes-consed-between-gcs i)
-                   (sb-ext:bytes-consed-between-gcs)))
+                   (truncate (sb-ext:bytes-consed-between-gcs)
+                             sb-vm:+highest-normal-generation+)))
         ;; FIXME: These parameters are a) tunable in the source and b)
         ;; duplicated multiple times there and now here.  It would be good to
         ;; OAOO-ify them (probably to src/compiler/generic/params.lisp).