From c3c0e069ac56281c3bd018f968736242453eaf12 Mon Sep 17 00:00:00 2001 From: mpi Date: Fri, 27 Oct 2023 19:13:51 +0000 Subject: [PATCH] Do not decrement the swap counter if the anon is associated to a "bad" slot. When such anon is freed its content is obviously not living in swap. ok miod@ --- sys/uvm/uvm_anon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/uvm/uvm_anon.c b/sys/uvm/uvm_anon.c index abb3e8de3d8..4c4bf8eef3a 100644 --- a/sys/uvm/uvm_anon.c +++ b/sys/uvm/uvm_anon.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_anon.c,v 1.56 2023/09/02 08:24:40 mpi Exp $ */ +/* $OpenBSD: uvm_anon.c,v 1.57 2023/10/27 19:13:51 mpi Exp $ */ /* $NetBSD: uvm_anon.c,v 1.10 2000/11/25 06:27:59 chs Exp $ */ /* @@ -116,7 +116,7 @@ uvm_anfree_list(struct vm_anon *anon, struct pglist *pgl) uvm_unlock_pageq(); /* free the daemon */ } } else { - if (anon->an_swslot != 0) { + if (anon->an_swslot != 0 && anon->an_swslot != SWSLOT_BAD) { /* This page is no longer only in swap. */ KASSERT(uvmexp.swpgonly > 0); atomic_dec_int(&uvmexp.swpgonly); -- 2.20.1