summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylan Kammer <taylan.kammer@gmail.com>2026-08-22 22:49:49 +0200
committerTaylan Kammer <taylan.kammer@gmail.com>2026-08-22 22:49:49 +0200
commit02ad98e6e1f2261adbc1d57129235af962e070c0 (patch)
tree75b09f860aa5cdd6c716f0eaa19398cb61e46fa3
parent366618484a57a97bd2291cb43aae037eb3cd9ba4 (diff)
Little meta-alloc improvement.
-rw-r--r--src/zisp/gc/meta_alloc.zig8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/zisp/gc/meta_alloc.zig b/src/zisp/gc/meta_alloc.zig
index 4dec92d..aa21967 100644
--- a/src/zisp/gc/meta_alloc.zig
+++ b/src/zisp/gc/meta_alloc.zig
@@ -476,9 +476,11 @@ export fn flush_thread_reserves() void {
const tl = &tl_slab_infos[sci];
const slab: *Slab = &slabs[sci];
- // Just a rough check, assuming 4 KiB pages: If wm_hi - wm_lo >= 8 KiB,
- // it means there's a minimum of one untouched page in between.
- if (tl.wm_hi - tl.wm_lo > 8192 / @sizeOf(Unit)) {
+ // Given our chunked WM bumps and smallest size class, hi - lo > 4 KiB
+ // implies that there's at least one entire untouched page, as well as
+ // at least one >=128-byte slot before it, which can hold the metadata
+ // of the vacancy-list entry without faulting in an empty page.
+ if (tl.wm_hi - tl.wm_lo > 4096 / @sizeOf(Unit)) {
flush_to_vl(info, tl, slab);
}