ke/smr: allow invalid sequences in deferred_advance_commit

This was buggy when the race was lost and it ended up trying to commit a
deferred advance of 0, now explicitly make the magazine's sequence invalid and
do nothing in deferred_advance_commit, avoiding an integer underflow.
This commit is contained in:
Loïc Grégoire
2026-09-19 23:03:39 -04:00
parent e7655e9725
commit a9028e53ff
2 changed files with 6 additions and 0 deletions
+4
View File
@@ -792,6 +792,10 @@ pub const Zone = struct {
// We lost the race. If the magazine we got was fully filled,
// then put it in the depot. Otherwise, dispose of it.
if (cnt == magazine_size.load()) {
// Ensure this magazine isn't counted as a freed one,
// it is instantly reclaimable.
nm.seq = ke.smr.seq_invalid;
Depot.free(nm, &cpu.depot.full_mags, self.reuse_policy);
continue;
}