diff options
| -rw-r--r-- | src/zisp/gc/meta_alloc.zig | 8 |
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); } |
