wingo pushed a commit to branch wip-whippet
in repository guile.

commit 1bf250f62aa76f73d6bc7ad27b98d8224cc6e915
Author: Andy Wingo <wi...@igalia.com>
AuthorDate: Mon Sep 16 13:40:09 2024 +0200

    Heap growth can compete with lospace for nofl blocks
---
 src/mmc.c        | 7 ++++++-
 src/nofl-space.h | 6 ------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/mmc.c b/src/mmc.c
index bd0cc958b..2db1b2cc5 100644
--- a/src/mmc.c
+++ b/src/mmc.c
@@ -395,7 +395,12 @@ heap_reset_large_object_pages(struct gc_heap *heap, size_t 
npages) {
   GC_ASSERT(npages <= previous);
   size_t bytes = (previous - npages) <<
     heap_large_object_space(heap)->page_size_log2;
-  nofl_space_reacquire_memory(heap_nofl_space(heap), bytes);
+  // If heap size is fixed, we won't need to allocate any more nofl blocks, as
+  // nothing uses paged-out blocks except large object allocation.  But if the
+  // heap can grow, growth can consume nofl-space blocks that were paged out to
+  // allow for lospace allocations, which means that here we may need to
+  // allocate additional slabs.
+  nofl_space_expand(heap_nofl_space(heap), bytes);
 }
 
 static void
diff --git a/src/nofl-space.h b/src/nofl-space.h
index bad9c315d..ea7fe1c31 100644
--- a/src/nofl-space.h
+++ b/src/nofl-space.h
@@ -1291,12 +1291,6 @@ nofl_space_maybe_reacquire_memory(struct nofl_space 
*space, size_t bytes) {
   return pending;
 }
 
-static void
-nofl_space_reacquire_memory(struct nofl_space *space, size_t bytes) {
-  ssize_t pending = nofl_space_maybe_reacquire_memory(space, bytes);
-  GC_ASSERT(pending + NOFL_BLOCK_SIZE > 0);
-}
-
 static int
 nofl_space_sweep_until_memory_released(struct nofl_space *space,
                                        struct nofl_allocator *alloc) {

Reply via email to